Why "main" is not being displayed in the URL ? Here is the Plunker.
index2.html is the working file. I have modified index2.html to index.html to include routing but it's not working.
app.js has routing configuration
(function() {
var app1 = angular.module('plunker', ["ngRoute"]);
app1.config(function($routeProvider) {
$routeProvider
.when("/main", {
templateUrl: "main.html",
controller: "ControllerFile.js"
})
.otherwise({
redirectTo: "/main"
})
})
} ());
MainCtrl, notControllerFile.js2. you have mismatching versions of angularjs and angular-route (both need to be the same - 1.6.2 - or whatever you chose) 3. there are some issues with controller/service initiation (don't create new instances ofapp)