0

I am trying to execute this code

data-toggle="collapse" data-target={{form.$invalid ? '#errorP2' : '#infoDiv'}}

which will toggle either info or error according to the form validity.

How can I do that ?

AngularJS : 1.4 --- Bootstrap 3

1 Answer 1

1

I guess you just see something like this in the rendered markup :

data-target="{{ ng-binding"form.$invalid ? '#errorP2' : '#infoDiv'}}

or similar. Wrap it into qoutes so angular have a chance to parse the expression, and use an expression. 1.4.x do support ternarys :

data-toggle="collapse" data-target="{{form.$invalid==true ? '#errorP2' : '#infoDiv'}}"
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.