0

I have web application with structure like:

root -> [page1, page2, etc]

The problem is what i need router functionality only on page2 (for example). All other routes should be catched with otherwise like this:

$stateProvider.state('page2', { url: '/page2', controller:     'ShopsController', templateUrl: 'shops-tpl', reloadOnSearch: false });


$urlRouterProvider.otherwise(function() {
    window.location = $location.absUrl();
})

the problem is what otherwise and router initialized only if user access page2, if user access root page otherwise doesn't work :(

vorobey
  • 4,401
  • 3
  • 18
  • 20
  • Where do you run this code? Do you run it when angular initializes, inside the `.config` function? – ptf May 26 '14 at 07:25
  • 1
    I think you're trying to redirect to a non-registered route maybe you could try to empty the otherwise like .otherwise({}); or maybe this question could solve your problem : http://stackoverflow.com/questions/19321765/using-routeprovider-to-redirect-to-routes-outside-of-angular – tdhulster May 26 '14 at 09:15

0 Answers0