Enable/Disable Anchor Tags using AngularJS

后端 未结 11 1585
一整个雨季
一整个雨季 2020-12-01 05:45

How do I enable/disable anchor tags using the directive approach?

Example:

  1. while clicking on edit link, create & delete needs to be disabled or g
11条回答
  •  半阙折子戏
    2020-12-01 06:35

    Disclaimer:

    The OP has made this comment on another answer:

    We can have ngDisabled for buttons or input tags; by using CSS we can make the button to look like anchor tag but that doesn't help much! I was more keen on looking how it can be done using directive approach or angular way of doing it?


    You can use a variable inside the scope of your controller to disable the links/buttons according to the last button/link that you've clicked on by using ng-click to set the variable at the correct value and ng-disabled to disable the button when needed according to the value in the variable.

    I've updated your Plunker to give you an idea.

    But basically, it's something like this:

     


提交回复
热议问题