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.

enter image description here

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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -