everyone. I am not experienced with angular, so help needed. i have a directive :
app.directive('ngDirective', [ '$timeout', function ($timeout) {
return {
templateUrl: '../tpl/tpl.html',
restrict: 'E',
scope:{
item:'=',
},
link:function(scope, element, attrs) {
//some func here
scope.myFunction =function(item){
$(element).find('.myitem').css('-webkit-transform','scale(0.6)').animate({opacity:0},function(){
$timeout(function(){
var ListIndex = scope.$parent.$index;
scope.$parent.$parent.ItemsList.splice(ListIndex, 1);
scope.$parent.$parent.updateSomeStuff();
});
})
};
}
};
}]);
the problem is that scope.myFunction fires jQuery changes twice, first at the element, and then at its sibling at the list;at the same time it only deletes one element from list. if i remove parent scope functionality-jQuery works fine and fires one single time.if i remove jquery line -parent scope func works perfect, how i need to organize this correctly? i think that deleting from a list somehow binds jquery to run again, but i have no understanding of the process... What i am missing?