emberjs:有没有办法创建一个catch所有路由? [英] emberjs: is there a way to create a catch all route?
本文介绍了emberjs:有没有办法创建一个catch所有路由?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
换句话说,有没有办法设置一个带有catch的路由所有?这样的事情
Em.Route.extend({
route:/:segment / *
})
解决方案
是的,你现在可以创建一个路由像这样通过路线Globbing:
@resource'files',路径:'/ * filepath'
而发送到模型的
params
/ code> callback将包含一个名为 filepath的参数
它也可以在另一种方式 link-to
帮助者,您可以在此处执行类似
= link- to'files'mypath
Is there a way to create a route with dynamic segments that go to an arbitrary depth?
In other words is there a way to setup a route with a catch all? Something like this
Em.Route.extend({
route: "/:segment/*"
})
解决方案
Yes, you can now create a route like this via Route Globbing:
@resource 'files', path: '/*filepath'
And the params
parameter sent to the model
callback will include a param called filepath
It also works going the other way in a link-to
helper where you can do something like
= link-to 'files' mypath
这篇关于emberjs:有没有办法创建一个catch所有路由?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文