There are links that are dynamically generated on angular via ng-repeat .
Classes through ng-class . Here is the code:

  <a class="btn btn-mini" ng-click="locateTo($event,data)" ng-class="{'btn-danger':data.select}"> <span>{{data.title}}</span> </a> 

It is necessary that elements with a class (generated via ng-class ) p90 (they are displayed), the ng-click attribute is equal to false .

  • p90 Where does it come from, from ng-repeat? if you can bring the code with snares and with ng-repeat. and there you can already write ng-if. <div ng-if = 'p90' ng-click = 'false'> aaa </ div> - Vanya Avchyan
  • what for? why not just check inside the locateTo function ? - Grundy
  • Yes, for sure. I agree. It is more correct to check in it - Vanya Avchyan

1 answer 1

I understand that you need to check data.select .
If not, substitute your variable instead.

ngSwitch

 <div ng-switch on="data.select"> <a ng-switch-when='p90' class="btn btn-mini" ng-class="{'btn-danger':data.select}"> <span>{{data.title}}</span> </a> <a ng-switch-default class="btn btn-mini" ng-click="locateTo($event,data)" ng-class="{'btn-danger':data.select}"> <span>{{data.title}}</span> </a> <div ng-switch-default>default</div> </div> 

Well, or comrade @Grundy correctly advised here - check in the function locateTo data.select for equality p90 and return the corresponding value.

  • Through the switch so far it does not work (I know angular at the middle level). And all the other ways, replace the ng-click on all elements - Misha Spring
  • and data.select returns true or false - Misha Spring
  • @Misha Spring I guess data.select p90. if (data.select == 'p90') return false else 'what you want' You explain a little here, so you have to assume - Vanya Avchyan
  • Thank. Instead of data.select in switch, it was necessary to substitute data.style - Misha Spring