11

Im working on a complex app where I need to disable a link if the ID sent from backend meets a certain criteria. I'm using this now but not sure if it is correct:

ng-show="parentheaderData.casid === '807' || '806' || '808' ?false:true"

Does this look right?

4 Answers 4

10

Why don't you move this logic to a controller so you have

html :

ng-show="showParentheader(parentheaderData.casid)"

controller:

 $scope.showParentheader = function(id) {
     return  ! (id === '807' || id ==='806' || id ==='808');
 }
Sign up to request clarification or add additional context in comments.

Comments

10

Thanks for all the support. The correct solution was:

ng-hide="parentheaderData.casid == '806' || parentheaderData.casid == '807' || parentheaderData.casid == '808'"

Comments

2

you can do like this:

ng-show="(parentheaderData.casid === '807' || parentheaderData.casid ==='806' parentheaderData.casid === || '808') ? false : true"

or:

ng-show=" !(parentheaderData.casid === '807' || parentheaderData.casid ==='806' parentheaderData.casid === || '808')"

Comments

1
ng-show="(parentheaderData.casid === '807' || parentheaderData.casid ==='806' parentheaderData.casid === || '808') ? false : true"

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.