Ember.js Routing: Matching End of URL

I need to map the path in the url. The path should be the end of the URL after the given pattern, but I cannot do this. Ember.js always ends up matching it with the next slash.

var router = Ember.Router.extend({
    location: 'history',
    enableLogging: true,
    root: Ember.Route.extend({
        index: Ember.Route.extend({
            route: '/'

            repo: Ember.Route.extend({
                route: '/:repo_id',

                index: Ember.Route.extend({
                    route: '/'
                }),

                files: Ember.Route.extend({
                    route: '/files',

                    index: Ember.Route.extend({
                        route: '/'
                    }),

                    sub: Ember.Route.extend({
                        route: '/:path'
                    })
                })
            })
        })
    })
});

Using this router:

  • /myrepo/files/ will match root.repo.files.index
  • /myrepo/files/READMEwill match root.repo.files.subusingpath=README
  • /myrepo/files/folder/READMEwill match root.repo.files.suband redirect me to /myrepo/files/folder/because path=folderinsteadpath=folder/README

How can I find a route along a URL s path :path, even if it has a slash in it?

+5
source share
2 answers

Ember.js master. 1.0.0-pre2, Ember.js , .

, :, *. , :

Ember.Route.extend({
  route: '/:repo_id/files/*path'
});

, . , - files/ URL-, .

+3
+1

All Articles