0

I'm wondering if it's possible to trigger a route and show a different view in Angular without updating the URL.

Basically I am embedding an Angular app inside an existing web site, and I don't want my embedded app to alter the URL, but I do want view management via routing.

I understand I can use ng-include as suggested here, but I would rather use routing.

Community
  • 1
  • 1
Chad Johnson
  • 21,215
  • 34
  • 109
  • 207

2 Answers2

0

I don't think it's possible to use routing and not URLs. You can roll your own routing pretty easily using ng-switch and a rootScope variable which stores the current "route".

Jonathan Rowny
  • 7,588
  • 1
  • 18
  • 26
0

The ng-include approach would address your issue. I'm not sure what you mean when you say you'd rather use routing since routing by definition uses URLs, but, yes, you can load different views using a different mechanism. Take a look at Angular-ui ui-router which uses the concept of states and views in addition to routing. It sounds like the view mechanism in states might address what you want.

squidbe
  • 1,012
  • 1
  • 8
  • 13