2017-09-19 6 views
0

ページ-ない-found.component.ts* ngIfすべての時間を仕事doesntの

import { FormsModule, NgModel } from '@angular/forms'; 
import { ChangeDetectorRef, Component, ElementRef, OnInit, Renderer2, ViewChild, ViewEncapsulation } from '@angular/core'; 
import {CommonModule} from '@angular/common'; 
import {NgModule} from '@angular/core'; 
import { BrowserModule } from '@angular/platform-browser'; 
import { element } from 'protractor'; 
import { SplitButtonModule } from "primeng/primeng"; 
import { Router } from '@angular/router'; 

@Component({ 
    selector: 'app-page-not-found', 
    templateUrl: './page-not-found.component.html', 
    styleUrls: ['./page-not-found.component.css'] 
}) 
export class PageNotFoundComponent implements OnInit { 

    constructor() { } 

    ngOnInit() { 
    } 

} 

page-not-found.component.html 

<p *ngif=true> 
    page-not-found works! 
</p> 

問題が*ngifでは動作しません。システムを再起動してキャッシュをクリアしました。

Uncaught Error: Template parse errors: 
Property binding ngif not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations". ("[ERROR->]<p *ngif=true> 
    page-not-found works! 
</p> 
+0

'

' –

答えて

0

はちょうどこの使用:私は次のエラーを取得しています

<p *ngIf="true"> 
    page-not-found works! 
</p> 

*ngIfが正しくない*ngif

0

たび、あなたは以下のように角度構文を持つ* ngIf、[値=]、または(変更)方程式の反対の終わりはおそらく引用符で囲むべきです。それはあなたの価値のためにコンポーネントを見るために角を伝えます。だから私は、あなたがこのようなあなたのコンポーネントのフィールドを入れてお勧めします。その後、

truthy = true; 

と:

<p *ngIf="truthy"> 
    page-not-found works! 
</p> 

あなたが引用符でそれをラップしていない場合は、その文字列リテラルを前提としていて、そのおそらく文句を言いませんあなたに必要な結果を与えてください。

関連する問題