How to set root location for AngularJS router?

I would like to start navigation from http://mysite.com/hello/world , and not from the root of the site.

eg.

 $routeProvider .when('/myurl', { templateUrl: 'mytmpl.html', controller: 'MyCtrl' }); 

should respond when my url is http://mysite.com/hello/world/myurl

How can i do this?

+7
angularjs
Jun 26 '13 at 12:14
source share
2 answers

Add the base tag to the main HTML file, which is executed when the user goes to http://example.com/hello/world :

 <base href="/hello/world/" /> 

For more information, see the Developer's Guide / Using $ location

+6
Jun 26 '13 at 13:19
source share
— -

Adding basetag also poses a problem, adding double time.

Adding (.) For root in the url template as shown below: templateUrl: './mytmpl.html' - fixes the problem

0
May 27 '15 at 15:33
source share



All Articles