Skip to content Skip to sidebar Skip to footer

How To Show Previous Div Of Clicked Div In Angular.js

i have a html like this
displa

Solution 1:

I get the feeling that the question is missing information. E.g. are the .submain divs hardcoded, or created by iteration?

If however this is indeed the case, the directive is redundant. Change the HTML as:

<divclass="main"ng-controller="firstcontroller"><divclass="submain"><divclass="first"ng-show="display[0]">displayed</div><divclass="second"ng-click="display[0] = !display[0]">click</div></div><divclass="submain"><divclass="first"ng-show="display[1]">displayed</div><divclass="second"ng-click="display[1] = !display[1]">click</div></div><divclass="submain"><divclass="first"ng-show="display[2]">displayed</div><divclass="second"ng-click="display[2] = !display[2]">click</div></div></div>

And the controller:

 app.controller('firstcontroller',function($scope) {
     $scope.display=[false, false, false];
 });

Post a Comment for "How To Show Previous Div Of Clicked Div In Angular.js"