Reputation: 91959
I am building a Single Page Application(SPA), whose domain is http://teachme.com
. The routes could be seen as
teachApp.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
$routeProvider.
when('/teach/', {templateUrl: 'views/login_view.html'}).
when('/teach/overview', {templateUrl: 'views/overview_view.html'}).
when('/teach/users', {templateUrl: 'views/users_view.html'}).
otherwise({redirectTo: '/teach/'});
$locationProvider.html5Mode(true);
}]);
Now everytime i click on the tabs, the route changes and I see the different view, but URL changes to
http://teachme.com/#teach
http://teachme.com/#teach/overview
http://teachme.com/#teach/users
which fails the whole point of keeping the url unique and for bookmark purposes. Is there a way that routes work fine, but the URL stays to http://teachme.com
Thanks
Upvotes: 0
Views: 90
Reputation: 69581
The whole point of routes is to use deep linking, per the docs.
The domain & path components of your URL will always remain constant, however the component after the # is what changes, which allows bookmarks to work even though you are creating a single page app.
Short version is No, routing will not work if you don't want the portion of the URL after the # to be changed. To me it seems like you loose value for bookmarking in the absence of such additions.
Even on a single page app, you can bookmark the teach or overview section etc. Maybe you provide a bookmark link which always stamps the domain by itself in the bookmark for the user.
Upvotes: 2