0

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"
      })
    })

  }   ());
Antikhippe
  • 6,316
  • 2
  • 28
  • 43
Rahul
  • 163
  • 3
  • 12
  • what do you mean? – Rahul Apr 18 '18 at 08:28
  • Ach, this isn't a picture, it's just your code. Then again: post your code here, not somewhere else on external resource. – Psytho Apr 18 '18 at 08:31
  • but why?Plunker is a legit site.i have posted plunker links before this question too? – Rahul Apr 18 '18 at 08:32
  • 1. your controller name is `MainCtrl`, not `ControllerFile.js` 2. 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](https://stackoverflow.com/questions/20087627/how-to-create-separate-angularjs-controller-files) (don't create new instances of `app`) – Aleksey Solovey Apr 18 '18 at 09:29
  • i fixed the code but still it's not displaying main in the url – Rahul Apr 18 '18 at 10:56

0 Answers0