angularjs - How to change the state of multiple variables on click event? -
i have made page 3 links. want click 1 of links, associated behaviour should showup.
following code :
index.html
<html> <head> <title> siteman</title> <link rel= "stylesheet" href="stylesheet.css"> <!--<link rel="stylesheet" type="text/css" href="_styles.css" media="screen">--> <!--<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">--> <script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> <script src = "tree.js"></script> </head> <body ng-app="myapp"> <div> <div id = "header"> <h1>siteman rann 0.1</h1> </div> <div id ="nav"> <button> add attribute </button> <button> add user </button> <button> add doccument </button> </div> <div id = "aside" style="padding:5px"> <a href="" ng-click="attr=1">all attributes</a></br> <a href="" ng-click="user=1">all users</a></br> <a href="" ng-click="docs=1">all document types</a></br> </div> <div id = "section"> <table ng-controller="mainctrl" ng-show="attr"> <tr ng-repeat="x in attributes"> <td>{{x.name}}</td> </tr> </table> <table ng-controller="mainctrl" ng-show="user"> <tr ng-repeat="x in names"> <td>{{ x.displayname }}</td> </tr> </table> <table ng-controller="mainctrl" ng-show="docs"> <tr ng-repeat="x in extnsion"> <td>{{ x.extension }}</td> </tr> </table> </div> <div id = "article"> </div> <div id = "footer"> copyright © siteman rann </div> </div> </body> </html> i want if click on "all attributes" link, attr=1 , user , docs should assigned value 0 . should happen 3 links : attributes, users, document types .
<a href="" ng-click="attr=1;user=0;docs=0;">all attributes</a></br> <a href="" ng-click="attr=0;user=1;docs=0;">all users</a></br> <a href="" ng-click="attr=0;user=0;docs=1;">all document types</a></br>
Comments
Post a Comment