javascript - angularjs - ng-model input as string -
in angularjs have code:
<input type="text" ng-model="properties.foreground.value">
i want like:
<input type="text" ng-model="properties.{{type}}.value">
i changed part of model input string. not work. can done other way?
you need use bracket notation access property , not dot notation. because ngmodel
binds attirbute scope using =
, value not interpolated.
<input type="text" ng-model="properties[type].value">
Comments
Post a Comment