Reputation: 178
I'm trying to manipulate the value of ng-model in ionic. It works fine in name attribute.
<input type="radio" name="svData.q{{option.qoQID}}" value="{{option.qoID}}">
the output was right as expected:
<input type="radio" name="svData.q1" value="1">
I'm trying to use ng-model attribute instead of name. I've tried:
<input type="radio" ng-model="svData.q{{option.qoQID}}" value="{{option.qoID}}">
and it does not work.
Error: [$parse:syntax] Syntax Error: Token '{' is an unexpected token
was produced. I was expecting the output to be like:
<input type="radio" ng-model="svData.q1" value="1">
any solution or suggestion?
Upvotes: 0
Views: 135
Reputation: 401
I believe the ngModel directive will only bind the value
attribute of the input to a property on the scope. If you intend to bind the name
attribute then you will have to use the ngBind syntax {{ }}
the way you did in the beginning
Upvotes: 1