此问题在此处已有答案:
Can't bind to 'ngIf' since it isn't a known property of 'div' [duplicate](3个答案)
21天前关闭。
我只想在符合规则的情况下呈现该列,但它不识别我。
Angular
HTML
<div class="middlePoint">
<ion-row>
<ion-col class="col-12 text-center titles mt-5"> Ingresa tu PIN </ion-col>
<ion-col class="col-12 mt-2">
<ul class="pinCircle">
<li [class]="mePin.length > 0 ? 'active' : ''"></li>
<li [class]="mePin.length > 1 ? 'active' : ''"></li>
<li [class]="mePin.length > 2 ? 'active' : ''"></li>
<li [class]="mePin.length > 3 ? 'active' : ''"></li>
</ul>
</ion-col>
<ion-col class="mt- 2" size="12" *ngIf="messageError.length > 0">
<h3 class="text-center color-white">{{ messageError }}</h3>
</ion-col>
<ion-col size="12" class="my-loading" *ngIf="loading === true">
<ion-spinner name="dots"></ion-spinner>
</ion-col>
</ion-row>
</div>
COMPONENT.TS
@Component({
selector: "app-pin",
templateUrl: "./pin.component.html",
styleUrls: ["./pin.component.scss"],
})
export class PinComponent implements OnInit {
public messageError: string = "";
public loading: boolean = true;
public circlePin: any = 0;
public mePin: any = "";
我只想在符合规则的情况下呈现该列,但它不识别我。
1条答案
按热度按时间oxiaedzo1#
而不是将
*ngIf
加到<ion-col>
上。请尝试使用:
https://angular.io/api/core/ng-container#usage-notes
另外,检查您的模块是否有
CommonModule
导入。