@marcosmachado wrote:
Hello,
I started ionic project using "ionic start app blank"
but when I run it the initial controller isn't called. I put console.log("test") in LoginCtrl controller, but didn't work.
controller.js:
angular.module('starter.controllers', [])
.controller('LoginCtrl', function($scope) {
console.log("test");
});app.js
` angular.module('starter', ['ionic', 'starter.controllers'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
});
})
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('app', {
url: '/app',
abstract: true,
templateUrl: 'templates/login.html',
controller: 'LoginCtrl'
})
.state('login', {
url: '/login',
views: {
'menuContent': {
templateUrl: 'templates/login.html',
controller: 'LoginCtrl'
}
}
});
$urlRouterProvider.otherwise('/login');});`
Posts: 1
Participants: 1