angularjs - Unable to access scope property in directive -
i'm building combobox plugin in angular, , i'm @ point i'm getting sorts of weird behaviors can't figure out. here's 1 of them:
i have 1 directive (called linksedit) contains within comboboxes. in link function of linksedit directive, set following array:
scope.levels = [ { 'id': 'link', 'value': 'link'}, { 'id': 'affiliate', 'value': 'affiliate'}, { 'id': 'partner', 'value': 'partner'}, ];
in directive, have combobox directive, passing levels value:
<combobox data="levels" value="cb_value" search="data.level" strict></combobox>
and combobox have isolate scope:
scope: { 'data': '=data', 'search': '=search', 'value': '=value', }
i have code in combobox sets default value of combobox based on data.level is. linksedit directive called once (with new attribute set) , being repeated ng-repeat (to show existing data). added 2 console.logs @ beginning of combobox directive:
console.log(scope); console.log(scope.data);
for first instance of linksedit (not in repeat), scope.data has data expect. in ng-repeat, scope shows data property, scope.data comes undefined. i'm not sure why they're behaving differently.
Comments
Post a Comment