i m using location.path to navigate like
$location.path('#/foo');
while in app I am using route provider like
var app = angular.module("myApp", ['ngRoute'])
.config(function($routeProvider){
$routeProvider
.when("/foo",{
templateUrl: "templates/foo.html",
controller: "fooController"
})
.otherwise({
template : "<h1>None</h1><p>Nothing has been selected</p>"
});
});
but instead of producing url like
http://localhost:8001/#/foo
location.path traverses to
http://localhost:8001/#/%23/foo
and hence routeprovider is loading otherwise template and not the required template doesn't loads. How can I check that
Remove explicit #
from your route in $location.path('#/foo');
and change it to $location.path('/foo');
because angular itself append # tag
during route, which already seen in your question http://localhost:8001/#/%23/foo
, and when you give explicit one, then it encodes to %23