jeudi 27 mars 2014

AngularJS: create element dynamicly


Vote count:

0




How do I go about create an element in my controller? e.g. on a click event?


example controller:



function AddCtrl($scope){

$scope.add = function(){
// do stuff to create a new element?
}


}


example view:



<div ng-controller="AddCtrl">

<button ng-click="add()">Add</button>
// create <input type="text" ng-model="form.anotherField">

</div>


Any suggestions much appreciated.



asked 16 secs ago

User789

1,313





Aucun commentaire:

Enregistrer un commentaire