I have a div in which i have four radio options in ng-repeat, my problem is when i click on the button the div with list class should be duplicated and the ng-model should change lets say if it is having value 'breakfast.favourite' after the click it should become 'breakfast.favourite1' for the duplicated div
<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>
here is my controller
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=[];
}]);
Help me out on this one
Are you trying to achieve this?
http://jsfiddle.net/TheRodeo/taujuuq2/3/
<button ng-click="addItem()">Add Another</button>
<div>
<ul>
<li ng-repeat="breakfastItem in breakfast track by $index">{{breakfastItem}}</li>
</ul>
</div>
$scope.addItem = function()
{
$scope.breakfast.push($scope.breakfast.favourite);
}