私は次の機能を持っています:
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>