html - Anchor tag disable using ng-class and a condition -


i've table displayed has count coulmn & count has <a> tag href page. want show link count > 0 , disable count=0.

i've tried angularjs - ng-disabled not working anchor tag , came know using ng-disabled of no use.

using ng-class gonna help, i'm not able specify condition in ng-class.

p.s. want cursor:not-allowed written in ng-class itself. can't change css

here's html code

<tr ng-repeat="service in services">     <td>{{$index+1}}</td>     <td>{{service.servicename}}</td>     <td><a href="#/info/{{service.id}}">{{service.numberofscenarios}}</a></td> </tr> 

numberofscenarios displays count.

if want show basic information, use ng-show.

if want apply classes use ng-class. cursor:not-allowed css, if have on class apply ng-class="{'yourclassname':angular-condition}"

you use this:

<td>     <a ng-href="#/info/{{service.id}}" ng-show="service.numberofscenarios > 0"><span ng-bind="service.numberofscenarios></span></a> </td> 

the link won't show service.numberofscenarios === 0. there should no need add css then.

update:

<td>     <a ng-href="#/info/{{service.id}}" ng-show="service.numberofscenarios > 0">         <span ng-bind="service.numberofscenarios"></span>     </a>     <span ng-show="service.numberofscenarios === 0" ng-bind="service.numberofscenarios" style="cursor:not-allowed;"></span> </td> 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -