3
こんにちは誰も私は、研究angular2 *ngIf
と今イムworkindをしていると私は、このコード角度2 ngIf予期しないトークン#
<div *ngIf='courses.length > 0 ; then #coursesList else #noCourses'>
</div>
<ng-template #coursesList>
<h1>List of courses</h1>
</ng-template>
<ng-template #noCourses>
<h2>No courses yet</h2>
</ng-template>
に持っており、これは、ときに私私のcomponent.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
title = 'app hello';
courses=[];
}
私の問題はありますウェブサイトを実行します。私はこのエラーがあります:
Uncaught Error: Template parse errors:
Parser Error: Unexpected token # at column 27 in [courses.length > 0 ; then
#coursesList else #noCourses] in ng:///AppModule/[email protected]:5 ("
<h1>Angular</h1>
<div [ERROR ->]*ngIf='courses.length > 0 ; then #coursesList else
#noCourses'>
</div>
"): ng:///AppModule/[email protected]:5
なぜ私は理解していません私はなぜコピーペーストを使用したくないのか知る必要があるので、このガイドを参考にしてください。