我有一个 div,其中我在 ng-repeat 中有四个单选选项,我的问题是当我单击按钮时,应该复制带有列表类的 div,并且 ng-model 应该改变让我们说它是否具有价值'早餐。 favourite' 点击后它应该成为重复 div 的 'breakfast.favourite1'
<div class="main" ng-app="myApp" ng-controller="MyCtrl">
<div class="list">
<label class="item item-radio" ng-repeat="breakfastRecipe in breakfastRecipes" for="{{breakfastRecipe.name}}" ng-click="closeModal()">
<input type="radio" ng-model="breakfast.favourite" ng-value="breakfastRecipe.name" id="{{'breakfast'+breakfastRecipe.id}}" name="boolean" />
</label><br />
{{breakfast.favourite}}
</div>
<button>Add Another</button>
这是我的控制器
var app = angular.module('myApp', []);
app.controller('MyCtrl', ['$scope', function ($scope) {
$scope.breakfastRecipes = [{id : 1, name : 'BreakfastRecipe1'},{id : 2, name : 'BreakfastRecipe2'},{id : 3, name : 'BreakfastRecipe3'},{id : 4, name : 'BreakfastRecipe4'}];
$scope.breakfast=[];
}]);
帮我解决这个问题