1

I have a function called isApplication that does a validation on if a certain application is true or false. I want it to display a different bootstrap class depending on the results of the function

I want to use this function to determine which class gets printed on a certain div....for example

html:

<div ng-class="{'col-md-6':isApplication, 'col-md-3':!isApplication}"></div>

it doesnt seem to be working like the way i want it to...am i not using ng-class right?

2
  • 1
    Have you tried calling the function? { myclass: myFunction() } Commented May 18, 2018 at 17:31
  • @ChrisFarmer - yes that can be done , but if there are more classes and complex logic then should go for that option Commented May 18, 2018 at 17:53

1 Answer 1

2

can you try like this , make use of ternary operator

ng-class="isApplication ? 'col-md-6' : 'col-md-3'">
Sign up to request clarification or add additional context in comments.

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.