Home Angularjs scope var in template of custom directive
Reply: 0

Angularjs scope var in template of custom directive

user537
1#
user537 Published in April 25, 2018, 6:06 pm

I have a custom directive hello

myapp.directive('hello', function() {
 return {
link : function (scope, elem, attr) {
    scope.url = attr.url;
    console.log(scope.url);
},
template: '<div ng-include="\'[{url}]\'"></div>'
};
});

my html code is

<div url="mypage.html"></div>

I get the value mypage.html in my console.log but is not able to include the page it says

http://127.0.0.1:5000/[%7Burl%7D]
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.323332 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO