Hi everyone, I have a problem with running my controller after declaring it.
This is my current code:
app.js
var myApp = angular.module('starter', ['ionic']);
myApp.controller ("venueCtrl", function() {
this.test = [];
for (var i = 0; i < 100; i++) {
this.test.push(i);
};
console.log("123");
})
index.html
<body ng-app="starter">
<ion-nav-bar class="bar-stable">
<ion-nav-back-button></ion-nav-back-button>
</ion-nav-bar>
<ion-nav-view></ion-nav-view>
</body>
tab-view.html (the template that I am editing)
<ion-view title = "Venue" ng-controller="venueCtrl as main">
<ion-list>
<ion-item collection-repeat="item in main.test">
{{item}}
</ion-item>
</ion-list>
</ion-view>
What I am trying to do is just listing a list of number from 1 to 100 using collection-repeat. I use console.log to show some debug (I am using serve --lab with console option on). However, the console doesn't show anything. I have tested already to see that the console is working (I put console.log outside of the declaration of the controller). So now I am not so sure what's wrong since I have checked some sources and the controller declaring seems correct to me. Any help would be appreciated. Thanks