Background : Angularjs application (angularjs version 1.3.15)
Problem : main page display nothing
Demo code (with a small small error but serious):
In app.js
angular.module('myApp', [ 'ngCookies', 'ngResource', 'ngSanitize', 'ngRoute' ]) .config(function($routeProvider) { $routeProvider .when('/', { templateUrl: 'views/main.html', controller: 'MainCtrl' }) .otherwise({ redirectTo: '/' }); });
In main.js
console.log('Before main controller'); var app = angular.module('myApp', []); app.controller('MainCtrl', function ($scope) { console.log('In main controller'); }); console.log('After main controller');
In my console, it displays only :
Before main controller After main controller
What’s wrong ??
Continue reading