Vote count:
0
HTML
<div my-test="{{widget.code}}"></div>
AngularJS
.directive('myTest', function() {
return {
templateUrl : function(elem, attr) {
console.log(attr.myTest);
return 'urlfilter-widget.html' || 'blank-widget.html';
}
};
})
I have this codes above and I am trying to retrieve the value under myTest which is the value that {{widget.code}} has. I also tried to search for solutions and possible workaround [1] [2] [3], and it seems I couldn't get through the problem.
console.log(attr.myTest) always tells me {{widget.code}} but if I try to see the source it will display the value that I am needing. Can somebody point me to what solution I can do on this? Thank you!
[1] http://ift.tt/PJuK73 [2] Accessing attributes from an AngularJS directive [3] http://ift.tt/1yue6Lx
asked 19 secs ago
AngularJS: Retrieving value from custom directive attribute
Aucun commentaire:
Enregistrer un commentaire