0

I am building a simple angular app, below is the sample code of my app.js it is working fine, the url is coming as "http://localhost:58539/#/" which is as expected, but i want the application name to be append "MyApp" like, "http://localhost:58539/MyApp/#/", i am not getting a way to do that,

angular.module('AngularApp', [
    'ngRoute'
])
.config(['$routeProvider', '$httpProvider',
function($routeProvider, $httpProvider) {
"use strict";

$routeProvider
    .when('/', {
        controller: 'HomeController',
        controllerAs: 'ctrl',
        templateUrl: '/app/views/home.html'
    })
    .when('/home', {
        controller: 'HomeController',
        controllerAs: 'ctrl',
        templateUrl: '/app/views/home.html'
    })
    .when('/detail', {
        templateUrl: '/app/views/detail.html'
    })
nitin
  • 156
  • 2
  • 13

1 Answers1

0

You should try <base href="/MyApp"> on your HTML. If this does not work, try with html5 mode as seen here https://docs.angularjs.org/guide/$location#html5-mode Be aware that this will need configuration on the server side.

Kautsky Lozano
  • 722
  • 12
  • 21
  • and making html5 mode to true, will make hash(#) symbol invisible also i need to show that – nitin Jul 02 '15 at 13:09
  • not works tried html5 mode and base href and also that is throwing error when page getting refreshed – nitin Jul 02 '15 at 13:39
  • That's because html5 mode needs server configuration for your routes. Check out this [question](http://stackoverflow.com/questions/16677528/location-switching-between-html5-and-hashbang-mode-link-rewriting) for more information – Kautsky Lozano Jul 02 '15 at 17:10