Reputation: 1717
I have a lot of data within ng-repeat. It looks like table with many rows and columns. I want to put ng-click
directive on some of cell of table.
Can i put some condition before ng-click
directive? If this condition is true - I want to put the directive, otherwise - not to put.
Upvotes: 0
Views: 307
Reputation: 3932
Maybe this is what you were looking for?
<ul class="menuItems">
<li ng-repeat="item in menuItems">
<div ng-if="item.type == 'link' ">
<a href="item.url" title="item.description">{{item.name}}</a>
</div>
<div ng-if="item.type == 'function' ">
<span ng-click="function(item.command)" title="item.description">{{item.name}}</span>
</div>
</li>
</ul>
Upvotes: 0
Reputation: 10252
I think you should just put the directive in there and pass it a condition as a parameter which returns boolean. In the directive compile function check if your parameter is right and decide from there what you load.
Upvotes: 1