使用指令时,Angular会给出@ angular / core 404找不到错误

前端之家收集整理的这篇文章主要介绍了使用指令时,Angular会给出@ angular / core 404找不到错误前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
当我将这行代码添加到我的@Component中时:
directives: [HeroDetailComponent]@H_403_2@ 
 

代码中断,并给我这个错误

GET http://localhost:3000/@angular/core 404 (Not Found)@H_403_2@ 
 

这些是我的index.html中的脚本:

<script src="node_modules/es6-shim/es6-shim.min.js"></script>
<script src="node_modules/systemjs/dist/system-polyfills.js"></script>
<script src="node_modules/angular2/es6/dev/src/testing/shims_for_IE.js"></script>   

<script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="node_modules/rxjs/bundles/Rx.js"></script>
<script src="node_modules/angular2/bundles/angular2.dev.js"></script>@H_403_2@ 
 

如果我错过了诊断此问题的任何信息,请告诉我,我会将其包含在此处.

如果要使用RC版本的Angular2,则需要以这种方式配置SystemJS:
var packages = {
  'app': { main: 'main.js',defaultExtension: 'js' },'rxjs': { defaultExtension: 'js' },'angular2-in-memory-web-api': { defaultExtension: 'js' },};

var packageNames = [
  '@angular/common','@angular/compiler','@angular/core',// <--------
  '@angular/http','@angular/platform-browser','@angular/platform-browser-dynamic','@angular/router','@angular/router-deprecated','@angular/testing','@angular/upgrade',];

packageNames.forEach(function(pkgName) {
  packages[pkgName] = { main: 'index.js',defaultExtension: 'js' };
});

var config = {
  map: map,packages: packages
}

System.config(config);@H_403_2@ 
 

如果要使用beta版本,在脚本元素中包含node_modules / angular2 / bundles / angular2.dev.js文件后,请导入此包:

import {Component,Directive,...} from 'angular2/core';@H_403_2@
原文链接:https://www.f2er.com/angularjs/143307.html

猜你在找的Angularjs相关文章