javascript - load json data into li with ng-repeat -


i can't load data list ng-repeat, here's app

http://plnkr.co/edit/dd05tnnlg66h6nklbjhm?p=preview

in line 12 of app.js wrote

$scope.tabs = tabs; 

which tabs object in data.js

one strange thing occur too, when console.log in maincontroller scope, tend execute twice. wonder

you're using $scope.tabs.push add data tabs. can't because $scope.tabs object , not array. change data.js :

var tabs = [     {         'tabid':1,         'tabname': 'main',         'tabfriends':[             {'name':'someone1'},             {'name':'someone1'},         ]     },     {         'tabid':2,         'tabname': 'programming',         'tabfriends':[             {'name':'someone2'}         ]     } ]; 

it's array, can push now. , angularjs happy repeat on it.

and tab object has tabname property, while on addtab function call name.


Comments

Popular posts from this blog

Change the color of an oval at click in Java AWT -

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -