Angular2.0报错:Unhandled Promise rejection: Failed to load..Zone: <root>

09-29 15:27:04   来源:shikezhi   评论: 点击:

zone js:1274 GET http: localhost:3000 dist components template hero-form component html 404 (Not Found) zone js:355 Unhandled Promise rejection: Failed to load http: localhost:3000 dist components template hero-form component html ; Zone: ;
 
zone.js:1274 GET http://localhost:3000/dist/components/template/hero-form.component.html 404 (Not Found)
zone.js:355 Unhandled Promise rejection: Failed to load http://localhost:3000/dist/components/template/hero-form.component.html ; Zone: <root> ; 
Task: Promise.then ; Value: Failed to load http://localhost:3000/dist/components/template/hero-form.component.html undefined
zone.js:357 Error: Uncaught (in promise): Failed to load http://localhost:3000/dist/components/template/hero-form.component.html(…)
 
 
解决办法,去掉或注释掉moduleId: module.id:
@Component({
    //moduleId: module.id,
    selector: 'hero-form',
    templateUrl: './template/hero-form.component.html'
})
export class HeroFormComponent {
    powers = ['能量1', '能量2', '能量3'];
 
    myHero = new Hero(18, '小强', this.powers[0], 'Strong,Kind,Friendy,Brave');
 
    submitted = false;
 
    onsubmit() { this.submitted = true };
 
    get diagnotic() { return JSON.stringify(this.myHero); }
 
}
 

相关热词搜索:Angular2 0 错误

上一篇:2016最全Angular2.0正式版百度盘高清MP4视频下载分享(英文版) 下一篇:Angular2.0报错If ngModel is used within a form tag, either the name attribute
分享到: 收藏