将 AngularFire 与 Angular ui-router 一起使用时如何启用路由安全性?路由、安全性、Angular、AngularFire

2023-09-06 08:59:33 作者:你的他不是他

是否可以使用AngularFire routeSecurity 模块使用 angular UI-ROUTER 而不是标准的 ng-route 提供程序?是否有可以与 ui-router 一起使用的 routeSecurity 版本?

Is it possible to use theAngularFire routeSecurity module with angular UI-ROUTER instead of the standard ng-route provider? Is there a version of routeSecurity that would work with ui-router?

推荐答案

@mattvv 给了我这个 gist 当我在有角度的 irc 频道中谈论他的时候.所以基本上你只需要替换 angularfire 目录中的 routesecurity.js 文件,假设你使用 yeoman 来搭建你的应用程序.

@mattvv Gave me this gist while I was talking on him in the angular irc channel. So essentially you would just need to replace the routesecurity.js file in angularfire directory assuming that you used yeoman to scaffold your application.

一个巧妙的做法是创建另一个名为 routesecurity-ui-router.js 的文件,而不是替换 routesecurity.js 的内容.

A neat thing to do is just to create another file named routesecurity-ui-router.js instead of replacing the content of the routesecurity.js.

所以为了提供一些关于要点的信息,基本上 mattvv 只是修改了 routes 术语并改用 state.

So to give a little bit of information about the gist, basically mattvv just modified the routes term and use state instead.