0
<!-- Angular.JS Form to JSON -->
var formApp = angular.module('formApp', []).controller('formController', ['$scope', function ContactController($scope) {
$scope.form = [];
$scope.milestone_subindicator = {data:'',year:'' , data:'',year:''
}
$scope.push_form = function(){
$scope.form.push({name:'',milestone:[]})
};
}]);
<!-- Form -->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular.min.js"></script>
{{form}}
<button type="button" class="success button" ng-click="push_form()">Add</button><!-- Add form -->
<body ng-app="formApp" ng-controller="formController">
<div class="row" ng-repeat="f in form track by $index">
<input type="text" placeholder="G1" data-ng-model = "f.name"></input> // name of the orgranisation
<div class="row" ng-repeat = "mil in milestone_subindicator track by $index"> // milestones
<div class="medium-2 columns">
<label>Data
<input type="text" placeholder="data" ng-model="mil.data">
<input type="text" placeholder="year" ng-model="mil.year">
</label>
</div>
</div>
</div>
</body>
在上面,你可以看到的輸出處的示例{{形式}}我需要把的mil in milestone_subindicator
值在里程碑被推數組的形式。我不知道我該如何實現這一目標?
幫助將不勝感激:)
milestone_subindicator = {數據: '',年: '',數據: '',年: ''}是一個對象。一個對象不能有重複的鍵 – brk