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 /#!/?

LatentDenis
  • 2,839
  • 12
  • 48
  • 99
  • Possible duplicate of [AngularJS "#!" on url](http://stackoverflow.com/questions/41111409/angularjs-on-url) – Kolby May 02 '17 at 17:39
  • @Kolby Do you think you can help? I've mentioned some additional information in Upal's answer below.. – LatentDenis May 02 '17 at 18:33
  • Previous answer was deleted, but try adding this: `$locationProvider.hashPrefix('');` – Kolby May 03 '17 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? http://stackoverflow.com/questions/43764279/angularjs-ngroute-not-serving-desired-home-page-in-asp-net-core-project – LatentDenis May 03 '17 at 17:33

0 Answers0