Return to site
· Webapplications,Development,array,Angula js,ng-model
broken image

You need to use arrays to hold datas such as telephone numbers,addresses etc in your application. Lets see how to create an array using ng-model in Angular.js to store datas. If you want to store phone number in an array define $scope.telephone as an array in your controller.

You have to use $complile Angular service to address the problem of ng-model not being recognised when you append a new input. $compile compiles an HTML string or DOM into a template and produces a template function,which can then be used to link scope and template together.

var input = angular.element('

');

// Compile the HTML and assign to scope

var compile = $compile(input)($scope);Read more