Angular.js route is not working

Multi tool use
Multi tool use


Angular.js route is not working



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'
})
}]);





for /home, you can simply give '/' instead of '/home' and please share your html as well for home
– Naga Sai A
Jun 30 at 18:54





Possible duplicate of AngularJS All slashes in URL changed to %2F.
– georgeawg
Jun 30 at 22:40




1 Answer
1



you can try with



use $locationProvider


$locationProvider


angular.module('myApp', ['ngRoute'])
.config(['$locationProvider', function($locationProvider) {
$locationProvider.html5Mode(false);
$locationProvider.hashPrefix('');
}]);






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

8Rn0x wnc
XFQn1i3yapdndYqQwfCEo,udza6ZeJw2nA

Popular posts from this blog

PySpark - SparkContext: Error initializing SparkContext File does not exist

django NoReverseMatch Exception

Audio Livestreaming with Python & Flask