Javascript Angular 2不能包含templateUrl
我不能相信这一点,我不能加载模板为2小时。谷歌真可耻,这太糟糕了。我知道这很烦人。 这是我的代码Javascript Angular 2不能包含templateUrl,javascript,angular,Javascript,Angular,我不能相信这一点,我不能加载模板为2小时。谷歌真可耻,这太糟糕了。我知道这很烦人。 这是我的代码 import { Component } from '@angular/core'; @Component({ selector: 'mw-app', templateUrl: 'app/app.component.html', }) export class AppComponent 项目结构 --angular2-training --app --app.compone
import { Component } from '@angular/core';
@Component({
selector: 'mw-app',
templateUrl: 'app/app.component.html',
})
export class AppComponent
项目结构
--angular2-training
--app
--app.component.ts
试图添加
moduleId:module.id,
并更改了tsconfig.js
“模块”:“commonjs”
尝试使用required(),没有任何帮助。真糟糕。如果您使用WebPack,请帮助我尝试以下方法:
@Component({
selector: 'about',
template: require('./about.component.html'),
styles: [String(require('./about.component.scss'))]
})
仔细检查模板的路径。。并尝试在模板位于ts文件的同一目录之前放置./before模板是否位于同一目录?你不需要“app”,只需要“/app.component.html”你使用什么构建系统?你遵循什么教程?你的HTML文件在哪里?我有根文件夹angular2和文件夹应用程序。Html在应用程序文件夹中,其中是我的ts文件这是指向教程的链接可以帮我导出什么是网页包我在gitwebpack上下载了一些lynda教程像Gulp这样的工具来构建你的应用程序(缩小..将es6传输到es5..然后解决依赖关系)尝试在你的urlused npm前面使用./,是吗?我是php开发人员,不熟悉angular,会试试的