Model binding is not working when creating different type inputs dynamically with AngularJs ng-repeat -
please @ code @ plunker http://plnkr.co/edit/tzi0xm if input type fixed (all text or checkbox...), there's no problem, data binding working, if defined input type dynamically, second input binding doesn't work, please me.
<ul> <li ng-repeat="prop in currentnode.props"> {{prop.name}}<input ng-model="prop.value" type="{{prop.type}}"></input> </li> </ul>
ok here html
<li ng-repeat="prop in currentnode.props"> {{prop.name}}<input ng-model="prop.value" checked="{{prop.value}}" type="{{prop.type}}"></input> </li>
and controller code
var app = angular.module('plunker', []); app.controller('mainctrl', function($scope) { $scope.currentnode = {name:'cube', props:[ {name:'displayname',value:'new cube',type:'text'}, {name:'visible',value:'checked',type:'checkbox'} ]}; });
and here plunk http://plnkr.co/edit/zy5lh9
hope helps :)
Comments
Post a Comment