0

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.

1
  • 3
    you can always put ng-click but neutralize it with a ng-disabled Commented Oct 17, 2013 at 20:24

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.