首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >angular2无法加载ng2引导数据选择器

angular2无法加载ng2引导数据选择器
EN

Stack Overflow用户
提问于 2017-02-22 07:40:00
回答 1查看 320关注 0票数 0

我已经在system.config中尝试了几种组合--但是我仍然得到这个错误

Error: Error: XHR error (404 Not Found)在XMLHttpRequest.wrapFn as _onreadystatechange at ZoneDelegate.invokeTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:265:35) at Zone.runTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:154:47) at XMLHttpRequest.ZoneTask.invoke (http://localhost:3000/node_modules/zone.js/dist/zone.js:335:33)加载引导程序时出错从http://localhost:3000/app/app.module.js加载作为"ng2-bootstrap“的http://localhost:3000/node_modules/ng2-bootstrap

我的system.config代码片段是

代码语言:javascript
复制
(function (global) {
System.config({
paths: {
  // paths serve as alias
  'npm:': 'node_modules/',
  'ng2-bootstrap':   "node_modules/ng2-bootstrap"
},
// map tells the System loader where to look for things
map: {
  // our app is within the app folder
  app: 'app',

  // angular bundles
  '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
  '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
  '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
  '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
  '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
  '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
  '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
  '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
  'rxjs': 'npm:rxjs',
  'moment': 'node_modules/moment',
  'ng2-bootstrap': 'node_modules/ng2-bootstrap',
  'ng2-bootstrap/ng2-bootstrap': 'node_modules/ng2-bootstrap/bundles/ng2-bootstrap.umd.js'
  // other libraries

},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
  app: {
    main: './main.js',
    defaultExtension: 'js'
  },
  rxjs: {
    defaultExtension: 'js'
  },
  'ng2-bootstrap': {
    "defaultExtension": "js"
 }    
}  });   })(this);

有人能帮我找出错误吗?帮我弄明白哪里出了问题?

EN

回答 1

Stack Overflow用户

发布于 2017-04-28 20:16:15

看看客户机用来获取日期选择器文件的URL:http://localhost:3000//ng2-bootstrap

虽然您已经在systemjs.config.js中映射了'ng2-bootstrap‘的起始路径,但是您还没有映射任何以'node_modules’开头的路径。在项目中搜索包含“node_modules”的URL,并从路径中删除“node_modules”。然后,客户端应该使用服务器可以成功映射到“ng2-bootstrap”路由的URL。

再提醒一句:我认为你的第二个路由'ng2-bootstrap/ng2-bootstrap‘有问题。因为它以与它上面的路由相同的部分路径开始,所以我认为这个路由永远不会适用,因为第一个路由总是匹配的。您也应该验证此路由。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42380054

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档