Home angularjs ng-disabled with MVC Model and angular scoped model
Reply: 1

angularjs ng-disabled with MVC Model and angular scoped model

M. Brandel
1#
M. Brandel Published in 2018-02-13 20:48:41Z

I want to use a combination of my angular model and MVC model to disable an anchor tag (Model.Technician is a bool):

<a href="#" title="" class="btn btn-default" ng-disabled="selectedTasksCount <= 0 || '@Model.Technician' == 'true'" >Click here</a>

I ended up having to do this:

<a href="#" title="" class="btn btn-default" ng-disabled="selectedTasksCount <= 0 || '@Model.Technician' == 'ng-disabled'" >Click here</a>

... because Model.Technicain always seems to render as 'ng-disabled'. What am I doing wrong or is there a better way?

stadnik0ff
2#
stadnik0ff Reply to 2018-02-13 20:54:19Z

Instead of writing a tonn of conditions into ng-disables it would be better to write a function into controller which return boolean result.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.331103 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO