Search code examples
angularjsangularjs-ng-include

ng-include throws [$parse:syntax] error


I am trying to give ng-include="'http://www.myxyzsite.com/assets/view/partial.html'".but it gaves error like

Syntax Error: Token ':' not a primary expression at column 5 of the expression [http://www.myxyzsite.com/assets/view/partial.html] starting at [http://www.myxyzsite.com/assets/view/partial.html].

Is it possible to use ng-include with absolute path?

Anybody know, what i am doing wrong?


Solution

  • You can use $templateCache object to place your live data into it and use ng-include after

    // read page using get
    $http.get('link-to-page', {cache:$templateCache});
    

    And you can iclude this data after using ng-include directive

    ng:include src="link-to-page"></ng:include>