2

私は ng-repeat に 4 つのラジオ オプションがある div を持っています。私の問題は、ボタンをクリックすると、リスト クラスの div が複製され、ng-model が変更され、値が 'breakfast.クリックすると、複製された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=[];
}]);

これについて私を助けてください

http://jsfiddle.net/hari_k/sjvrau3a/8/

4

1 に答える 1