Angular 2最终版本Visual Studio-无法确定模块名称,module.id传递的路径不正确/导致404

Angular 2最终版本Visual Studio-无法确定模块名称,module.id传递的路径不正确/导致404,angular,Angular,我刚刚升级到Angular 2最终版本(我使用的是Visual Studio 2015和TypeScript 1.8),注意到我的组件中的行moduleId:module.id现在有了红色的扭曲下划线,并说找不到名称“module” 在Chrome的网络选项卡中,我看到templateUrl和styleURL路径都不正确 这是我的工作组件: @Component({ selector: 'dashboard', moduleId: module.id, templateU

我刚刚升级到Angular 2最终版本(我使用的是Visual Studio 2015和TypeScript 1.8),注意到我的组件中的行
moduleId:module.id
现在有了红色的扭曲下划线,并说
找不到名称“module”

在Chrome的网络选项卡中,我看到
templateUrl
styleURL
路径都不正确

这是我的工作组件:

@Component({
    selector: 'dashboard',
    moduleId: module.id,
    templateUrl: 'dashboard.component.html',
    styleUrls: ['dashboard.component.css'],
    styles: ['.chart {display: block; width: 100%;} .title.handle{background-color:transparent;}']

})
**但是当我删除行
moduleId:module.id
时,我得到一个404错误,因为它正在查找:

http://localhost:56159/dashboard.component.css
http://localhost:56159/dashboard.component.html

任何帮助都将不胜感激


谢谢你

试试这个,把这两个文件的路径放在前面

@Component({
    selector: 'dashboard',
    templateUrl: './dashboard.component.html',
    styleUrls: ['./dashboard.component.css'],
    styles: ['.chart {display: block; width: 100%;} .title.handle{background-color:transparent;}']

})

您将需要引用节点定义typescript文件。

如您所见,模块在第70行定义

declare var module: NodeModule;

相同的结果
styleURL:['./dashboard.component.css'],
导致
http://localhost:56159/dashboard.component.css
能否尝试升级您的打字脚本版本?根据Angle文档,这是理想的行为。您是否也升级了angular cli?@EduardoDennis我没有使用angular clicli@SefaÜmitOray我会试试,尽管其他开发人员也在使用这台机器,所以我不能只是暂时试用-我如何在Angular 2最终版本中引用它?你应该通过typings definition manager安装它。运行
npm install typings
会再次安装打字,但不会影响
moduleId:module.id,
typings install dt~节点--save--global下的红色波形