fatlog
fatlog

Reputation: 1192

Angular Expression in Template not evaluating

I'm building a page using ng-repeat, pulling in a template. The template creates a checkbox and I am trying to set the "checked" value on it using the ternary operator. I am adding it like follows...

<input type='checkbox' name='checkbox' {{val.isTrue ? 'checked' : ''}}> 

But when I run this the expression is not interpreted. I just see the expression printed in the DOM. I know the expression can evaluate because if I do...

<input type='checkbox' name='{{val.isTrue ? 'checked' : ''}}'>

or

<input type='checkbox' name='checkbox'>{{val.isTrue ? 'checked' : ''}}

I can see the value printed.

Any ideas what I am doing wrong?

Thanks

Upvotes: 0

Views: 115

Answers (1)

user1364910
user1364910

Reputation:

Use ngChecked.

ng-checked="val.isTrue"

Upvotes: 2

Related Questions