为什么此组件返回“无长度”而不是“存在长度”?
这是代码
app.component.ts:
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
length:number = 1;
}
app.component.html:
<div *ngIf="length > 0; then length else noLength"></div>
<ng-template #length>length exist</ng-template>
<ng-template #noLength>no length</ng-template>