angularjs - ng repeat not updating -


hi newbie angular js , hoping can me out following problem.

i have numeric field called numadults , need show set of field (such name, address, telephone etc ) numadult times information each of person.

here jsfiddle problem jsfiddle link

here overview of code of controller

function bookingcontroller($scope){ $scope.numadults = 1; $scope.personloop = function(){     console.log('personloop called')     return new array($scope.numadults);     //return new array(2);  } 

the html

<label for="book_num_adults">number of adults:</label> <input id="book_num_adults" type="text" ng-model="numadults">     <div class="row" ng-repeat="t in personloop()" style="border:2px solid red;margin-top:10px">       <h4>person {{$index+1}}</h4>        <input placeholder="name"><br>        <input placeholder="address"><br>        <input placeholder="telephone"><br>   </div> 

can me how transform module ( not controller based )

thank in advance!

your fiddle riddled errors...

http://jsfiddle.net/brgtr/5/

  1. under frameworks & extensions, need change 2nd dropdown "onload" 1 of "no wrap" options
  2. your controller definition mangled. it's supposed be: .controller('name', ['depname', function (depname) { })]); -- had closing array misplaced.
  3. you should use semi-colons.
  4. you don't create array of 5 items in javascript this: var = new array(5), creates array contains 5. instead, should var = []; a.length = 5;

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -