简体   繁体   English

带有身份验证登录页面的angular2应用

[英]angular2 app with authentication login page

<navigation title="dashboard" has-header="true" > <auth-router-outlet></auth-router-outlet> </navigation>

I'm working on a angular2 app with authentication. 我正在使用angular2应用程序进行身份验证。 I have a navigation toolbar shared between all the page except login page. 除了登录页面之外,所有页面之间共享一个导航工具栏。 But with the configuration above the login page will have the navigation toolbar. 但是使用上面的配置,登录页面将具有导航工具栏。 Not sure what is a better way to implement this, which seems common in most apps. 不确定实现此目的的更好方法是什么,这在大多数应用程序中似乎很常见。 Thanks! 谢谢!

navigation is a component I created with navbar on top. 导航是我在导航栏顶部创建的一个组件。 auth-router-outlet extends angular's default router-outlet with authentication and redirect to login page if not authenticated. auth-router-outlet通过身份验证扩展了angular的默认路由器出口,如果未通过身份验证,则重定向到登录页面。

对我来说,使用ngIf并不是一个好ngIf ,因为呈现登录页面时,不仅会ngIf工具栏,还会从DOM中删除工具栏。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM