You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get SyntaxError: Parse error at my directive line where I want to use a "&" one-way binding from a parent directive's method
myApp.directive('datasourceDeleteBtn',[function(){return{restrict: 'E',replace: true,template: '<a href="#">✕</a>',scope: {datasourceIndex: '@',removeParentDiv: '&'},link: link};functionlink(scope,element,attr){element.bind('click',function(event){event.preventDefault();scope.deleteDatasource(scope.datasourceIndex);});// Notify parent directivescope.deleteDatasource=function(datasource_index){// conditional stuff that happens not included// {} required for passing values to "&" parent scope methodscope.removeParentDiv({datasource_index});};}}]);
HTML
<parent-divng-repeat> // this is just a mockup not literal
<datasource-delete-btndatasource-index="{{$index}}" remove-parent-div="removeParentDiv()"></datasource-delete-btn></parent-div>
The parent div of the ng-repeat that passes removeParentDiv
// parentDiv directive has thisscope.datasources=[];scope.removeDatasourcePicker=function(index){scope.datasources.splice(index,1);// ie take it out};
It seems the problem is that Jasmine does not like the { }. Removing the brackets results in the test going through (with typical errors since & requires {}).
The text was updated successfully, but these errors were encountered:
I get
SyntaxError: Parse error
at my directive line where I want to use a "&" one-way binding from a parent directive's methodHTML
The parent div of the ng-repeat that passes removeParentDiv
It seems the problem is that Jasmine does not like the { }. Removing the brackets results in the test going through (with typical errors since & requires {}).
The text was updated successfully, but these errors were encountered: