javascript - How to include a pageURL in a html template of a directive -
i want include extend pageurl in html template of angularjs directive. here simplest example case.
angular.module('pageinclude', []) .directive('pageinclude', function() { return { restrict: 'e', replace: true, scope: { exturl: '=' }, template: "<div><h1>page include</h1><ng-include src=\"'{{exturl}}'\"></ng-include></div>" } }); my html code is:
<page-include ext-url="example/extendform.html"></page-include> then got following error:
error: [$interpolate:noconcat] error while interpolating: '{{exturl}}' strict contextual escaping disallows interpolations concatenate multiple expressions when trusted value required. see http://docs.angularjs.org/api/ng.$sce http://errors.angularjs.org/1.3.15/$interpolate/noconcat?p0='%7b%7bexturl%7d%7d' @ regex_string_regexp (angular.js:63) @ $interpolate (angular.js:10152) @ addattrinterpolatedirective (angular.js:8101) @ collectdirectives (angular.js:7203) @ compilenodes (angular.js:7035)
are there way make case work? reply.
try change
exturl: '=' to
exturl: '@' or change attr value to
ext-url="'example/extendform.html'"
Comments
Post a Comment