AngularJS ng-click : Adding same Div/Widget on each click -
the following code display divs 1 after :
<ul class="record"> <li id="{{record.id}}" ng-repeat="record in records"> <div> widget code.... </div> </li> </ul>
apart have following clickable list menu @ right side in drop down fashion :
<li ng-repeat="choice in items"> <a href="#">{{choice}}</a> </li>
now on click of each list item want add same <div> widget code.... </div>
append existing divs on page.
my recent view following want add div on click of each of list item after existing divs.
need help. thank you.
this should trick:
<li ng-repeat="choice in items"> <a href="#" ng-click="addrecord()">{{choice}}</a> </li>
and in controller:
var addrecord = function(){ $scope.records.push({id: 10}); // change generate own id };
Comments
Post a Comment