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

  }   ());
5
  • what do you mean? Commented Apr 18, 2018 at 8:28
  • Ach, this isn't a picture, it's just your code. Then again: post your code here, not somewhere else on external resource. Commented Apr 18, 2018 at 8:31
  • but why?Plunker is a legit site.i have posted plunker links before this question too? Commented Apr 18, 2018 at 8: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 (don't create new instances of app) Commented Apr 18, 2018 at 9:29
  • i fixed the code but still it's not displaying main in the url Commented Apr 18, 2018 at 10:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.