Migrated to AngularJs 1.3, child elements in ngRepeat not longer see directive's scope -



Migrated to AngularJs 1.3, child elements in ngRepeat not longer see directive's scope -

in angular 1.2, element within ngrepeat can see parent scope's function(isconvotabactive). however, after switch 1.3, no longer working. checked migration guide found nothing. how can prepare without using $parent.isconvotabactive?

app.directive('mydirective',function(){ homecoming { restrict: 'e', scope: { }, controller: ["$scope", "$element", "$attrs", function($scope, $element, $attrs) { $scope.isconvotabactive = function(convoid) { homecoming convoid == $scope.indexes.activeconvoid; }; } }, template: "<div ng-repeat='(convoid, convo) in convos'>" + "<div ng-if='isconvotabactive(convoid)'></div>" + "</div>", replace: true, // replace directive element link: function (scope, element, attrs) { scope.indexes = { "activeconvoid": "111" }; scope.convos = { "111": { "title": "convo 111" }, "222": { "title": "convo 222" } }; } } })

edit1 tried ng-show, doesn't work either.

edit2 works on plunker. i'm not sure why. http://plnkr.co/edit/7pdp40cqzuqoiswxgn4u

:

as alternative solution, less refactoring, utilize ng-show (as long have no problem element beingness hidden dom rather removed). ng-show doesn't create kid scope.

angularjs angularjs-scope angularjs-ng-repeat

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -