2017-07-06 82 views
-4

我不理解app.component.ts & app.component.htmlangular 2之間的區別。app.component.ts&app.component.html有什麼區別

我可以使用兩者來創建頁面。然後在開發網頁時使用什麼。

請指導我,我是angularjs2的新手。 謝謝!

+0

我沒有你正在嘗試定義你的HTML部分作爲模板

問。但是,如果你要求'template' /'templateUrl'之間的區別,請參閱:https://stackoverflow.com/questions/34673979/what-are-differences-of-using-component-template-vs-templateurl-in -angular2-type –

+0

正是我想問的問題,謝謝。 –

回答

0

app.component.ts - 該文件是爲任何組件 app.component.html主類文件 - 該文件是可以與應用組件

app.component.ts被綁定組件的HTML有一個@組件裝飾中,你也可以,如果你想給任何HTML文件的外部鏈接,那麼你將使用templateUrl並通過HTML文件到它