deepthan/blog-angular

ngIf的时候报No provider for TemplateRef!

deepthan opened this issue · 0 comments

这是由于写法错误,首先得引入ngIf的包commonModule,之后按照下面两种写法其中任意一种即可。

<div *ngIf="bool" >
</div>

或者

<template [ngIf]="bool">
    <div></div>
</template>