重複的div我在angularjs每次點擊角
$scope.count = 0;
$scope.increment = function(){
$scope.count = $scope.count + 1;
console.log("count " + $scope.count);
};
$scope.decrement = function() {
if($scope.count > 0) {
$scope.count = $scope.count - 1;
}
};
一個計數器,並且如果計數值大於1的計數器由在點擊一個按鈕遞增我會顯示一個div。每次我點擊我增加計數器。事實上,櫃檯進展順利,但我會在每次點擊時創建一個div。現在我只能生成一個div。這是HTML的一部分
<a class="uk-button" data-ng-click="increment()">
<i class="uk-icon-plus" ></i>
New div
</a>
<div class="uk-panel" data-ng-if="count >= 1">
<hr>
<div class="uk-panel uk-width-1-1 qt-add-row">
<form class="uk-form uk-form-horizontal uk-float-left">
<div class="uk-form-row" data-ng-repeat="item in data.row">
<label class="uk-form-label" for="form">{{item.name}}</label>
<div class="uk-form-controls uk-width-1-1">
<input id="form" class="uk-width-1-1" type="text" placeholder="{{item.name}}" ng-model="field.value">
<span style="position: absolute" class="uk-button-group">
<a class="uk-button" href="#">
<i class="uk-icon-close"></i>
</a>
</span>
</div>
</div>
</form>
</div>
</div>
你想重複哪個'div'? 'a'下面的父母「.uk-panel」? – matewka 2015-02-24 11:25:13
確切的說,是的.... – 2015-02-24 11:26:41