angularjs - Angular js:Dynamic values as string in ng-model within ng-repeat -
i generating form dynamically in application. fields of forms column names in database table.the user of application pass name of table , skeleton crud application prepared dynamically.
in view part want achieve this
<div class="form-group" ng-repeat="(key,col) in cols"> <label for="{{::col}}">{{::col | uppercase | replaceunderscore}}</label> <input class="form-control" type="text" ng-model="{{::col}}" required /> </div> in ng-model need string value is, if column name username model value should ng-model="username" , value should not displayed in form field. want achieve kind of 1 way data binding.
simply use js object, example $scope.data = {}, , ng-model="data[col]".
Comments
Post a Comment