And the ...">

AngularJS - Getting next marriage spot in ng-repeat

Given this very simplistic markup:

<div ng-repeat="item in items" item>

      

And the directive:

app.directive('item', function()
{
    return function(scope, element, attrs)
    {


    }
})

      

Say to click event, I want to get the next area and do something. I can either use scope.$$nextSibling()

or element.next().scope()

.

Is there an advantage / disadvantage of using either? Or is there a better way to get the next Brother Orb?

+3


source to share


2 answers


you should do it in scope, call $ rootScope. $ broadcast ('SOME_CHANGE_IN_SCOPE', ...); in the sibling scope, call $ scope. $ on ('SOME_CHANGE_IN_SCOPE', ...) you can of course wrap the data in an event, check the angularjs file for more details



+1


source


Not sure what you are trying to do, but you should never use angular variables starting with $$

. They are for internal implementation and do not guarantee that they will remain from release to release.



0


source







All Articles