javascript - Pass data object to directive inside ng-repeat -
i have problems passing info object ng-repeat inner directive. can find here: jsbin
in chrome developer tools can see info object not defined, can't figure out why. pass directive , bind scope.
i thought each loop of ng-repeat scope build , directive within parsed. correct?
in add-on want pass info object directive , access info there , set listeners on object. possible?
this snippet of directive code:
return { restrict: 'e', scope: { data: "=" }, link: function(scope, element, attrs) { // here problem, info undefined console.log(data); what can see access undefined variable data. have do, access via scope.data. do:
link: function(scope, element, attrs) { console.log(scope.data); // here scope.data there working plunker
javascript angularjs
No comments:
Post a Comment