在我app.component.ts
我必須定義templateUrl
就象這樣:相對URL具有角4和帆沒有工作
import {Component} from '@angular/core';
@Component({
selector: 'root-component',
templateUrl: './app/app.component.html'
})
export class AppComponent { }
如果我定義它只是作爲./app.component.html
它給這個錯誤控制檯:
所以基本上這意味着app.component.html是accebile從http://localhost:1337/app/app.component.html,因爲我sailsroot/asset
文件夾結構是這樣的:
這將是非常不方便寫templateUrls這種方式,因爲例如在asset/app/sidebar
文件夾中的sidebar
組件templateUrl
會這樣寫:./app/sidebar/sidebar.component.html
我想在templateUrl相對URL以得到妥善解決我不知道該怎麼做。
如果有幫助,我遵循this教程。 (我所有的tsconfig.json,package.json等都與這裏給出的相同)。
你應該使用'應用程序/ app.component.html' – Aravind
@Aravind任何理由,爲什麼我應該用這種方式(即使我不希望) ? – rahulserver
哪一個你使用'systemjs'或'webpack' – Aravind