【发布时间】:2017-01-20 02:18:16
【问题描述】:
我有一个基于 Angular2 和 Express 的网络应用程序。我正在尝试实现一个安全的 API 端点,并且正在作弊并使用 Auth0。我正在关注guide,但是,我的设置似乎并没有进展。我的应用目前正在崩溃:
GET /angular2-jwt 404 30.433 毫秒 - 14
尽管我有这个system.config.js:
(function (global) {
System.config({
paths: {
'npm:': 'node_modules/'
},
map: {
app: 'app',
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
//all the other angular packages
'angular2-jwt': 'node_modules/angular2-jwt/angular2-jwt.js',
'rxjs': 'npm:rxjs',
'angular2-in-memory-web-api': 'npm:angular2-in-memory-web-api'
},
packages: {
app: {
main: './main.js',
defaultExtension: 'js'
},
rxjs: {
main: 'Rx.js',
defaultExtension: 'js'
},
'angular2-in-memory-web-api': {
main: './index.js',
defaultExtension: 'js'
},
'angular2-jwt': { defaultExtension: 'js' }
}
});
})(this);
为什么我的 system.config.js 不工作,或者我是否误解了如何使用 systemJS?
我的 index.html 包含:
<script src="./config/systemjs.config.js"></script>
<script>
System.import('app').catch(function(err){ console.error(err); });
</script>
如果我在 system.config 的 System.config({ 行的正上方添加一条 console.log 消息,它不会被触发。这是否意味着我的 system.config 没有被读取?
【问题讨论】: