这是我的HTML:
<script src="/static/angular-scripts/vendors/test/es6-shim.js" type="text/javascript"></script>
<script src="/static/angular-scripts/vendors/test/angular2-polyfills.js" type="text/javascript"></script>
<script src="/static/angular-scripts/vendors/test/system.src.js" type="text/javascript"></script>
<script src="/static/angular-scripts/vendors/test/Rx.js" type="text/javascript"></script>
<script src="/static/angular-scripts/vendors/test/angular2.dev.js" type="text/javascript"></script>
<script>
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
}
}
});
System.import('angular/core')
.then(null, console.error.bind(console));
</script>
上面的代码将输出:
GET http://my_url/angular/core 500 (Internal Server Error)
你如何配置SystemJS以便它不会从网址中找到路径,有没有办法对它进行配置?
答案 0 :(得分:1)
你在做什么角度/ core.it是anuglar2的API,来自你上面添加的网址。 通常我们使用System.import导入启动文件。 这是一个例子,
<script src="https://code.angularjs.org/2.0.0-beta.1/angular2-polyfills.js"></script>
<script src="https://code.angularjs.org/tools/system.js"></script>
<script src="https://code.angularjs.org/tools/typescript.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.1/Rx.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.1/angular2.dev.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/2.0.0-beta.0/router.dev.js"></script>
<script>
System.config({
transpiler: 'typescript',
typescriptOptions: { emitDecoratorMetadata: true },
packages: {'app': {defaultExtension: 'ts'}}
});
System.import('app/boot')
.then(null, console.error.bind(console));
</script>