AngularJS: URL parameters for routing

I would like to use URL parameters for routing in angularjs

I have an anguar application with two views: editView and mainView

Given a URL that looks like this: 'Httx: // MyApp / param1 = x & ... & EditMode = 1 & ...

-> lead me to the path / editMode

What would be a good way to do this?

  • I would need to use a controller to get $ routeparams.editmode and use $ location.path ('/ editmode') if editmode == 1?
  • Do I need html5 mode?

  • I can do nothing with url - I have to use editmode parameter


$routeProvider.when('/', { controller: function($routeParams, $location) { if($routeParams.editmode == '1') { $location.path('editMode') ... 
+6
source share
1 answer

I found out that “permission:” instead of “controller:” was what I needed. If someone is interested in changing routes through params, this is the path: https://github.com/angular/angular.js/issues/1838#issuecomment-13994168

+3
source

All Articles