Edster Edster - 9 months ago 48
Javascript Question

Assign dynamic html tag content by using angular function

I need to assign a dynamic html tag content to links.
Right now I have two links, one of which disabled. But I need to dynamically specify if it is disabled or not by calling function in my Angular 1 code.

<link rel="stylesheet" href="css/blue.css" title="blue" disabled/>
<link rel="stylesheet" href="css/red.css" title="red" />

Kindly appreciate for any help.

Answer Source

You need to use the directive ng-disabled. You can learn more about this directive on the official documentation of AngularJS.

Example of implementation for your case:

<link rel="stylesheet" href="css/blue.css" title="blue" ng-disabled="expression" />
<link rel="stylesheet" href="css/red.css" title="red" ng-disabled="expression" />