我想问一下,如何在彼此上创建不同的布局。例如,我有一个登录页面,所以基本上它没有标题(导航栏),登录后,它将重定向到主页,其中有标题,所以这意味着不同的布局。我刚刚开始学习angular 2。谢谢!
发布于 2016-10-12 00:56:41
看一下*ngIf...您可以定义基于布尔值显示或隐藏的整个代码块。
例如,从我的应用程序:
<div *ngIf="isSuccess" class="ui-grid-row form-group">
<div class="ui-grid-col-12">
<p>You have successfully verified your email address. We will take you to the login screen.</p>
<p>Thank you for signing up and we wish you the best.</p>
</div>
</div>
<div *ngIf="!isSuccess" class="ui-grid-row form-group">
<div class="ui-grid-col-12">
<p>Your email address verification has failed. Please resend the verification and try again.</p>
</div>
</div>发布于 2016-10-12 01:01:59
如果您希望在John Baird已经回答了问题的同一模板上进行更改,如果您希望拥有一个完全不同的模板,您应该希望创建一个组件和路由。创建一个新的组件ng g组件。创建一条路由/toComponent。
从您的登录组件重定向到这个新形成的组件。你可能想看看https://angular.io/docs/ts/latest/tutorial/toh-pt5.html
https://stackoverflow.com/questions/39982539
复制相似问题