javascript - dynamically change ng-repeat -


i have object made this:

var examples = {     'example1': {         ex1: {},         ex2: {},         ex3: {}     },     'example2': {         ex1: {},         ex2: {},         ex3: {}     } } 

there button linked function fills example1 object values on first click, , example2 object on second click.

  • first click: example1 values.
  • second click: example2 values.

then loop through object using ng-repeat, this:

data-ng-repeat="example in examples.example1.ex1" data-ng-repeat="example in examples.example1.ex2" data-ng-repeat="example in examples.example1.ex3" 

the problem here is, need ng-repeat somehow change , loop through example2 object aswell when button clicked second time. question is, there way change ng-repeat dynamically?

edit: goal first list of appear after first click, , both lists appear after second click.

i tried make $scope value 2 , put in ng-repeat, didn't work.

$scope.counter = 2; //in controller data-ng-repeat="example in examples.example(counter).ex1" 

would solution loop through "examples" instead, , have ng-repeat inside ng-repeat?

something this:

<div data-ng-repeat="example in examples">     <div data-ng-repeat="ext in example">         {{ext.ex1}} {{ext.ex2}} {{ext.ex3}}     </div> </div> 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -