问题
I want to replicate the text fields(div) present in image every time the user click on '+' button.
回答1:
If I understood your question properly , pls refer the below code .
Template
<div ng-app="myapp" ng-controller="myCtrl">
<div ng-repeat="item in items">
<input type="text" placeholder="name">
<input type="text" placeholder="email">
<button ng-click="add()">+</button>
<p>Some text some text some text</p>
</div>
</div>
controller
var app = angular.module('myapp',[]);
app.controller('myCtrl',["$scope",function($scope){
$scope.items = [{}];
$scope.add = function(){
$scope.items.push({});
}
}]);
refer: https://jsfiddle.net/ftzebggn/
来源:https://stackoverflow.com/questions/33210478/angularjs-replicate-div-on-click-of-button