I'm currently working on a project where I need to retrieve objects from the controller. Here's a snippet of my code:
score.component.js:
angular.module('score').component('score',{
templateUrl : 'app/score/score.template.html',
controller : ScoreController
});
function ScoreController() {
var returnData = function(){
return [{
name: "john",
totalscore: 13,
gamesPlayed: 14
},
{ name: "andrew",
totalscore: 1,
gamesPlayed: 2
}
];
}
}
score.template.html:
<div ng-repeat="player in $ctrl.returnData">
{{player.name}}{{player.totalscore}}{{player.gamesPlayed}}
</div>
I can't seem to get it to work as expected, any insights on what could be going wrong? Appreciate your help!