dimanche 30 octobre 2016

Arbitrary depth slash-delimited param value in Ember route

I have a route defined as:

Router.map(function() {
  this.route('folder', { path: '/f/:path' }, function() {} );
});

And the route itself as:

export default Ember.Route.extend({
  model(params) {
    const path = params.path;
    console.log(`path=${ path }`);
    return path;
  }
});

Currently:

http://localhost:4200/f/folder

works but

http://localhost:4200/f/folder/subfolder

throws a Uncaught UnrecognizedURLError {message: "/f/folder/subfolder", name: "UnrecognizedURLError"} since the router is expecting me to define a route at each level.

Use case is the ability for users to build an arbitrary tree of folders. Is there a way to do this?




Aucun commentaire:

Enregistrer un commentaire