Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

in visual studio 2013 i have setup a web api project and added an index.html page with angularjs framework: why, when i run the project, the url is

http://localhost:49375/index.html#/

How can i remove the index.hmtl# for the root page?

In angularjs i have the following route:

gestionale.config(['$routeProvider',
  function ($routeProvider) {
  $routeProvider.
    when('/', {
        templateUrl: 'View/people.html',
        controller: 'mainController'
   });
}]);

and in the WebApiConfig.cs:

config.Routes.MapHttpRoute(
            name: "DefaultApi",
            routeTemplate: "api/{controller}/{id}",
            defaults: new { id = RouteParameter.Optional }
        );
share|improve this question
add comment

1 Answer

I think you refer to:

$locationProvider.html5Mode(true);

It is use something like this:

angular.module('demoApp',['ngRoute'],function ($routeProvider, $locationProvider)
{
    $locationProvider.html5Mode(true);

    $routeProvider.
        when('/',{
...

It basically lets you use angular routing without the # prefix character.

share|improve this answer
    
he also needs to setup some «match all» server-side route pointing to the bootstraping view or use IIS UrlRewrite...otherwise he'll be disappointed when he starts getting 404 errors :) –  António Sérgio Simões 20 hours ago
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.