我有以下功能:
var app = angular.module('Hubbub-FrontEnd', []);
app.controller('DataEntryCtrl', function($scope) {
$scope.entryFields = [
{pHolder:'ID goes here',ngmodel:"kid"},
{pHolder:'Description goes here',ngmodel:"desc"},
{pHolder:'Drop Dead Date goes here',ngmodel:"ddd"}
];
});
这在下面被调用html
。
<div ng-controller="DataEntryCtrl">
<span ng-repeat="entryField in entryFields">
<input type="text" ng-model="{{entryField.ngmodel}}" placeholder=
"{{entryField.pHolder}}">
</span>
<button>Add</button>
</div>