0

friends, I am new in angular js and I was trying to work with angular Route, but when I click on #/home it gives me some strange URL http://127.0.0.1:3000/#!/home#%2Fhome

But By default, the otherwise condition is working fine http://127.0.0.1:3000/#!/home

app.config(['$routeProvider', function($routeProvider){

    $routeProvider
    .when('/home', {
        templateUrl: 'views/home.html'
    })
    .when('/list', {
        templateUrl: 'Views/listing.html',
        controller: 'mycontroller'
    }).otherwise({
        redirectTo: '/home'
    })
}]);
R. Richards
  • 24,603
  • 10
  • 64
  • 64
  • for /home, you can simply give '/' instead of '/home' and please share your html as well for home – Naga Sai A Jun 30 '18 at 18:54
  • Possible duplicate of [AngularJS All slashes in URL changed to %2F](https://stackoverflow.com/questions/41272314/angularjs-all-slashes-in-url-changed-to-2f/41273403#41273403). – georgeawg Jun 30 '18 at 22:40

1 Answers1

0

you can try with

use $locationProvider

angular.module('myApp', ['ngRoute'])
    .config(['$locationProvider', function($locationProvider) {
           $locationProvider.html5Mode(false);
           $locationProvider.hashPrefix('');
}]);
Krishna Rathore
  • 9,389
  • 5
  • 24
  • 48