Sunday 15 February 2015

angularjs - Pass a reference to DOM object with ng-click -


I have many elements of the same callback on ng-click:

    
  // In the controller: $ scope.doSomething = function () {// How do I get the button reference function triggers ? };   

How can I get a reference to the object that did something to call? (I have to delete an entry from it)

angular way angle is shown in the column :)

The use of these are:

  & lt; Body & gt; Check me to read the text only: & lt; Input type = "checkbox" ng-model = "check" & gt; & Lt; Br / & gt; & Lt; Input type = "text" ng-readable = "check" value = "I'm angular" /> & Lt; / Body & gt;   

Basically the angular method is to create a model object that should be used to read the input or not and after that the model object must be set accordingly. The beauty of angularity is that most of the time you do not need to manipulate any domes. You have rendered angular to see how your model is set to your model (angular manipulates dome for you and keeps your code clean).

So in your case basically you want to do something like below or see an example of work.

  & lt; Button ng-click = "isInput1ReadOnly =! Input1ReadOnly" & gt; Click me & lt; / Button & gt; & Lt; Input type = "text" ng-readable = "isInput1ReadOnly" value = "angular rule!" / & Gt;    

No comments:

Post a Comment