模板,我跟着Angular 2 Quickstart指南,但出現以下錯誤:錯誤:未找到MyAppComponent
Error during instantiation of Token(AppView)!. ORIGINAL ERROR: Error: No template found for MyAppComponent
這是相關代碼:
import {Component, View} from 'angular2/core';
import {bootstrap} from 'angular2/platform/browser'
// Note I've changed Template to View here as I think it is a typo
....
@View({
template: '<h1>Hello {{ name }}</h1>'
})
....
這裏繼鄧肯展位的建議http://blog.ionic.io/angular-2-series-introduction/我做出了以下更改和一切正常:
import {Component, Template} from 'angular2/core';
import {bootstrap} from 'angular2/platform/browser';
....
@Template({
inline: "<h1>Hello {{ name }}</h1>"
})
....
但是yesimahum在同一鏈接上的評論提到「查看是新的語法」,這似乎是,Angular 2 Step by Step Guide中所示的情況。
那麼爲什麼Quickstart代碼會拋出錯誤,什麼是正確的修復?
在我的問題中,我特意只顯示了相關代碼,並且我還說View和** not ** Template是新的語法。 –
我完全理解你說的話,因爲這就是它在文檔中的內容....我不知道爲什麼它現在不工作 –