UI Modeling WORKING
see http://jsfiddle.net/vorburger/P8gt8/1/
by vorburger
HTML
<div ng-controller="MyCtrl">
<div ng-repeat="auimodel in uimodel">
<label>{{$index + 1}}. {{auimodel.label}}</label>
<input ng-model="datamodel[auimodel.model]" type="{{auimodel.type}}" />
</div>
<br/>
<p>Name: {{datamodel.contact.name}}, Email: {{datamodel.contact.email}}</p>
</div>
JavaScript
var myApp = angular.module('myApp', []).controller('MyCtrl', function ($scope) {
$scope.datamodel = {};
$scope.datamodel.contact = {
name: "Ellie",
email: "[email protected]"
};
$scope.uimodel = [{
label: 'Yer Name:',
model: 'contact.name',
type: 'text'
}, {
label: 'Yar Email:',
model: 'contact.email',
type: 'email'
}];
});