angularjs - angular src working fine with relative path, but not ng-src -



angularjs - angular src working fine with relative path, but not ng-src -

within directive, using angular ng-include src attribute this:

template: '<div ng-include src="\'app/views/address_detail_view.html\' "></div>' +...

this works ok.

now using exact same statement ng-src instead of src:

template: '<div ng-include ng-src="\'app/views/address_detail_view.html\' "></div>' +...

then inclusion not work. nil happens, no exceptions raised.

my final goal include var within src (or ng-src) attribute, if this:

template: '<div ng-include src="{{myvar}}' "></div>' +...

then exception: [object xraywrapper [object domexception]]

ns_error_dom_bad_uri: access restricted uri denied

this why striving create ng-src work doesn't seem find relative url.

any ideas why ng-src isn't working or should file bug angular team?

thanks in advance

if @ docs

you can see src attribute expecting "angular expression." meaning src attribute needs no {{myvar}} style syntax. instead if have scope var myvar nowadays in directive scope when instantiate directive value of myvar placed in src.

<div ng-include src="myvar"></div>

so in case:

return { link:function($scope) { $scope.myvar = 'x.html'; }, template: '<div ng-include src="myvar' "></div>' +... }

angularjs angularjs-directive angularjs-ng-include

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -