jQuery + client-side template = “Syntax error, unrecognized expression”

后端 未结 6 1043
离开以前
离开以前 2020-12-04 19:09

I just updated jQuery from 1.8.3 to 1.9, and it started crashing all of a sudden.

This is my template:



        
6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-04 19:26

    I had the same error:
    "Syntax error, unrecognized expression: // "
    It is known bug at JQuery, so i needed to think on workaround solution,
    What I did is:
    I changed "script" tag to "div"
    and added at angular this code
    and the error is gone...

    app.run(['$templateCache', function($templateCache) {
        var url = "survey-input.html";
        content = angular.element(document.getElementById(url)).html()
        $templateCache.put(url, content);
    }]);
    

提交回复
热议问题