目前,我练习角度4. 当普通用户查看此时显示公共内容当注册用户进入网页然后显示编辑或某些内容.如何最佳实践显示有条件的模板或一些Html内容示例:
<div *ngIf="isUser">
some Content here......
</div>
<div *ngIf="!isUser">
some Content here .....
</div>
Run Code Online (Sandbox Code Playgroud)
实际上,我想知道如何做到最好.
如何可能检查子路由器是否活动,在 angular 4 中显示状态真或假,
现在我使用:/* @angular/cli: 1.4.4 node: 8.6.0 typescript: 2.3.4 @angular/路由器:4.4.4 */
我的父母路线是:
const routes:Routes=[
{
path: '', component: SummaryOfFindingsComponent,
children:[
{
path:'data-time-frame', component: DataTimeFrameComponent
},
{
path:'email-address', component: EmailAddressesComponent
},
{
path:'repair-orders', component: RepairOrdersComponent
},
{
path:'total-records', component:TotalRecordsComponent
},
{
path:'unique-households', component: UniqueHouseholdsComponent
},
{
path:'unique-vins', component: UniqueVinsComponent
}
]
}
]
Run Code Online (Sandbox Code Playgroud)
父组件是:
export class SummaryOfFindingsComponent implements OnInit {
isUserSelected;
constructor() { this.isUserSelected=false; }
ngOnInit() { }
isUserItemSelect(){
this.isUserSelected=true;
}
}
Run Code Online (Sandbox Code Playgroud) router if-statement conditional-statements angular-routing angular
我正在尝试创建带有形状箭头的SVG按钮,我在此处使用路径我的代码,有人建议我解决此问题
<svg height="100" width="300">
<a href="#"><path id="lineAB" d="M0 1 l 280 0 l50 50 l-50 50 l-280 0 z" stroke="gray" stroke-width="2" fill="red" /></a>
</svg>Run Code Online (Sandbox Code Playgroud)