1

Try change condition ng-click, if lenght > 1 is clickable, esle not.

ng-click="filtered.length >1 ? 'false' : 'true' || showSomething($index)"

What is wrong?

3 Answers 3

3

you could do that

<a ng-click="1==1 ? test() : null">click</a>
Sign up to request clarification or add additional context in comments.

2 Comments

It's best for me, thnx @daniel
Man I love uuuuu
2

You can simply put the check inside your function:

$scope.showSomething = function($index){
    if(filtered.length >1){
       //your code
    }
};

So, the HTML becomes:

ng-click="showSomething($index)"

Comments

0

There is also ng-disabled, which may be helpful. https://docs.angularjs.org/api/ng/directive/ngDisabled

<div data-ng-click="showSomething($index)" data-ng-disabled="filtered.length <=1"></div>

Please note though, that this does change the look/feel of the button (ie. disabled button).

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.