1

I'm developing an ASP.Net Core Application that uses AngularJS (version 1). I've got a problem that when I run/launch the application, the home URL always comes out to:

http://localhost:59745/#!/

The specific question I have is towards why it's saying /#!/ and not just the expected root /.

My Startup.cs that declares the MapRoute for the application:

app.UseMvc(config =>
{
    config.MapRoute(
        name: "Default",
        template: "{controller}/{action}/{id?}",
        defaults: new { controller = "App", action = "Index" }
        );
});

My app.js declaring the angular seeding for the application/module:

var app = angular.module('myScheduler', ['ngStorage', 'ngRoute'])
    .config(function ($routeProvider) {
        $routeProvider.when("/", {
            controller: "homeController",
            controllerAs: "vm",
            templateUrl: "/views/home.html"
        });

        $routeProvider.otherwise({
            controller: "loginController",
            controllerAs: "vm",
            templateUrl: "/views/login.html"
        });
    });

Why is my URL showing the way it is, and how can I default it to just the root / rather than /#!/?

4
  • Possible duplicate of AngularJS "#!" on url Commented May 2, 2017 at 17:39
  • @Kolby Do you think you can help? I've mentioned some additional information in Upal's answer below.. Commented May 2, 2017 at 18:33
  • Previous answer was deleted, but try adding this: $locationProvider.hashPrefix(''); Commented May 3, 2017 at 16:17
  • @Kolby it didn't work, but I'm currently faced with another problem aside from this that doesn't allow me to fully implement any solution with this question. Do you think you can help? stackoverflow.com/questions/43764279/… Commented May 3, 2017 at 17:33

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.