0

We are investigating a migration from Backbone to Angular. Because of our design, we only need to migrate the router. I'd like to understand how wildcard routing works for angular. Here is an example of wildcard routing in Backbone:

app.Router = Backbone.Router.extend({
      routes: {
        '*filter' : 'setFilter'
      },
      setFilter: function(params) {
         //all traffic ends up here.  you can grab the url and go.
         var url = this.cdn + "templates/" + params + ".html";
         ...
      }
    });
app.router = new app.Router();
Backbone.history.start({pushState: true}); 
  1. What is the angular equivalent for wildcard routing?

  2. How does angular handle push state? Specifically, does it have a way to utilize /pushstate urls when the browser supports pushstate and then automatically roll back to #pushstate hash urls for IE9-

Thanks.

JStark
  • 2,788
  • 2
  • 29
  • 37

1 Answers1

0

1) There is not current support for regex in angular routing

2)Angular automatically handle pushstate if it is not available in browser then it will automatically fallback to hash mode# just use below lines

$locationProvider.html5Mode(false);
$locationProvider.hashPrefix('!');
Ajay Beniwal
  • 18,857
  • 9
  • 81
  • 99
  • Thanks for the response. Regarding (1), is there a way to leverage the angular router for legacy pages. e.g. if /legacy then call legacy() but if /newpages then leverage normal angular. – JStark May 08 '13 at 18:18