首页 \ 问答 \ Angular2-ui-switch发出错误(Angular2-ui-switch Giving an error)

Angular2-ui-switch发出错误(Angular2-ui-switch Giving an error)

我一直在尝试将angular2-ui-switch加载到我的应用程序中。但是我收到的错误如下:

Error: XHR error (404 Not Found) loading http://localhost:3000/angular2-ui-switch
        at XMLHttpRequest.wrapFn [as _onreadystatechange] (http://localhost:3000/node_modules/zone.js/dist/zone.js:698:29)
        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)
    Error loading http://localhost:3000/angular2-ui-switch as "angular2-ui-switch" from http://localhost:3000/app/app.module.js
(anonymous) @ ?buIds=fidelity-BlrEGL,demo-ETS:33
ZoneDelegate.invoke @ zone.js:232
Zone.run @ zone.js:114
(anonymous) @ zone.js:502
ZoneDelegate.invokeTask @ zone.js:265
Zone.runTask @ zone.js:154
drainMicroTaskQueue @ zone.js:401
ZoneTask.invoke @ zone.js:339

我已经完成了自述文件中给出的所有说明。 该模块的链接是: https//www.npmjs.com/package/angular2-ui-switch

我的systemjs.config.js是:

    /**
 * System configuration for Angular 2 samples
 * Adjust as necessary for your application needs.
 */
(function (global) {
  System.config({
    paths: {
      // paths serve as alias
      'npm:': 'node_modules/'
    },
    // map tells the System loader where to look for things
    map: {
      // our app is within the app folder
      'moment': 'npm:moment' ,
      app: 'app',
      'mydatepicker': 'npm:mydatepicker',
       'angular-2-dropdown-multiselect/src/multiselect-dropdown':'npm:angular-2-dropdown-multiselect/src/multiselect-dropdown',
      // 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',

      // other libraries
      'rxjs':                       'npm:rxjs',
      'angular2-in-memory-web-api': 'npm:angular2-in-memory-web-api',
      'angular2-google-maps': 'npm:angular2-google-maps',

    },
    // 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'
      },
      'angular2-in-memory-web-api': {
        main: './index.js',
        defaultExtension: 'js'
      },
      'angular2-google-maps':{
        main: './index.js',
        defaultExtension: 'js'
      },
      mydatepicker: {
        defaultExtension: 'js'
      }, 
      'angular-2-dropdown-multiselect/src/multiselect-dropdown':{
        main:'../multiselect-dropdown',
        defaultExtension:'js'
      },    
      'moment': 'node_modules/moment/moment.js',
      'ng2-bootstrap/ng2-bootstrap': 'node_modules/ng2-bootstrap/bundles/ng2-bootstrap.umd.js',
      moment: { main: './moment.js', defaultExtension: 'js' },
    }
  });
})(this);

我究竟做错了什么 ? 提前致谢


I've been trying to load angular2-ui-switch into my application .but i've been getting an error as follows:

Error: XHR error (404 Not Found) loading http://localhost:3000/angular2-ui-switch
        at XMLHttpRequest.wrapFn [as _onreadystatechange] (http://localhost:3000/node_modules/zone.js/dist/zone.js:698:29)
        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)
    Error loading http://localhost:3000/angular2-ui-switch as "angular2-ui-switch" from http://localhost:3000/app/app.module.js
(anonymous) @ ?buIds=fidelity-BlrEGL,demo-ETS:33
ZoneDelegate.invoke @ zone.js:232
Zone.run @ zone.js:114
(anonymous) @ zone.js:502
ZoneDelegate.invokeTask @ zone.js:265
Zone.runTask @ zone.js:154
drainMicroTaskQueue @ zone.js:401
ZoneTask.invoke @ zone.js:339

I have follwed all the instructions given in the readme. The link to the module is : https://www.npmjs.com/package/angular2-ui-switch

my systemjs.config.js is :

    /**
 * System configuration for Angular 2 samples
 * Adjust as necessary for your application needs.
 */
(function (global) {
  System.config({
    paths: {
      // paths serve as alias
      'npm:': 'node_modules/'
    },
    // map tells the System loader where to look for things
    map: {
      // our app is within the app folder
      'moment': 'npm:moment' ,
      app: 'app',
      'mydatepicker': 'npm:mydatepicker',
       'angular-2-dropdown-multiselect/src/multiselect-dropdown':'npm:angular-2-dropdown-multiselect/src/multiselect-dropdown',
      // 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',

      // other libraries
      'rxjs':                       'npm:rxjs',
      'angular2-in-memory-web-api': 'npm:angular2-in-memory-web-api',
      'angular2-google-maps': 'npm:angular2-google-maps',

    },
    // 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'
      },
      'angular2-in-memory-web-api': {
        main: './index.js',
        defaultExtension: 'js'
      },
      'angular2-google-maps':{
        main: './index.js',
        defaultExtension: 'js'
      },
      mydatepicker: {
        defaultExtension: 'js'
      }, 
      'angular-2-dropdown-multiselect/src/multiselect-dropdown':{
        main:'../multiselect-dropdown',
        defaultExtension:'js'
      },    
      'moment': 'node_modules/moment/moment.js',
      'ng2-bootstrap/ng2-bootstrap': 'node_modules/ng2-bootstrap/bundles/ng2-bootstrap.umd.js',
      moment: { main: './moment.js', defaultExtension: 'js' },
    }
  });
})(this);

What am i doing wrong ? Thanks in advance


原文:https://stackoverflow.com/questions/42283441
更新时间:2020-10-17 15:10

最满意答案

您没有将模块添加到systemjs.config.js我猜

在地图中添加:

'angular2-ui-switch': 'npm:angular2-ui-switch'

并在包中:

'angular2-ui-switch': {
    main: 'node_modules/angular2-ui-swith-main-class-to-find'
    defaultExtension: 'js',
}

You didn't add the module to your systemjs.config.js I guess

Add this in the map:

'angular2-ui-switch': 'npm:angular2-ui-switch'

And in packages:

'angular2-ui-switch': {
    main: 'node_modules/angular2-ui-swith-main-class-to-find'
    defaultExtension: 'js',
}
2017-02-17

相关问答

更多

switch语句给出意外的','错误(switch statement giving unexpected ',' error)

您不能使用数字作为案例的名称。 只需将它们留下(R将使用第一个案例为1 ,第二个案例为2 ,依此类推,或者使用字符串[edit]并在数字上使用as.character 。 所以要么 qtr_start <- function(qtr, yr){ switch(qtr, paste(yr, "0101", sep = ""), paste(yr, "0104", sep = ""), paste(yr, "0107", sep = ""), ...

Angular ui-router未实例化,导致注入模块错误(Angular ui-router is not instantiated, giving an inject module error)

代码的问题是你有一个拼写错误,它应该是别的而不是otherwhise改变这部分: $urlRouterProvider.otherwhise("/state1"); 在这: $urlRouterProvider.otherwise("/state1"); The problem with the code is that you have a typo, it should be otherwise instead of otherwhise Change this part: $urlRou ...

QBSDK给出错误(QBSDK giving error)

事实证明,没有办法与QuickBooks建立两个连接。 您只能拥有一个,因此在运行sdktest应用程序时需要关闭QuickBooks应用程序。 我没有测试是否可以使用其他QuickBooks应用程序(QB Accountant,QuickBooks簿记员和QuickBooks企业)... It turns out that there is no way to do TWO connections to QuickBooks. You can have only one so the Quick ...

Angular 2给出错误Uncaught SyntaxError:意外的令牌<(Angular 2 giving an error Uncaught SyntaxError: Unexpected token <)

你使用的是哪个版本的angular2? 看来你正在使用angular2 beta和angular2 rc版本。 在候选版本中: import { Component } from '@angular/core'; 在以前的版本中 import {bootstrap} from 'angular2/platform/browser' 如果您继续rc,您可以使用: 在候选版本中,您不应该在脚本标记中添加角度库, 相反,你应该在系统js config中做模块 系统js config的示例 Sy ...

查询给出错误(Query giving error)

两个快速评论: 首先,您不需要对这些数字使用转换 - 只需将它们直接放入查询中,即 set @dateScoreCard = convert('4/1/2013'); 此外,在'where'条款中,您没有将dateiff的结果与任何事物进行比较。在datediff条款之后应该有一个部分,即: where datediff(.....) > 2 例如。 您的datediff功能仅为您提供一个数字,该数字是您给定的两个日期的差异,在您定义的条款中,这是几个月。 使用该数字来比较您希望sql语句为您 ...

Angular 2 RC2表单升级给出错误(Angular 2 RC2 forms upgrade giving error)

在你的 <input ... #controlName="ngForm"...> 删除#controlName="ngForm" (在你的情况下是#language="ngForm" ) 验证器将缺少此元素。 更改验证器 <div *ngIf="!controlName.untouched>Error!</div> 至 <div *ngIf="formGroupName.controls.controlName.required>Error!</div> 作为旁注,在此错误之后,我面临更多问 ...

IIS 8发出错误(IIS 8 giving an error)

用块替换块 <configuration> <system.webServer> <system.web> <fullTrustAssemblies> <clear/> </fullTrustAssemblies> </system.web> </system.webServer> </configuration> 从应用程序中删除对完全信任程序集的所有引用。 IIS附带完整的MSDN文档,它已经为此提供了解决方案 单击此 ...

Angular jsonp请求coursera api给出错误(Angular jsonp request coursera api giving error)

拒绝执行脚本...因为它的MIME类型('application / json')不可执行 URL https://api.coursera.org/api/courses.v1?callback=JSON_CALLBACK返回JSON,而不是JSONP。 当您发出JSONP请求时,服务器必须使用JSONP格式的数据(这是一种特殊形式的JavaScript脚本)进行响应。 你正在与之交谈的服务器没有。 这是我认为正确完成的代码,因为它成功获取了其他CORS资源。 JSONP是我们在CORS存在之前 ...

NSUserDefaults给出错误(NSUserDefaults giving error)

好吧,从你的问题看起来像早期发布的一些对象。 不能说问题出在哪里。 但试试这个 NSUserDefaults *defaults = [[NSUserDefaults standardUserDefaults] retain]; NSString * storedLanguage = [NSString stringWithFormat:@"%@",[defaults objectForKey:@"language"]]; [defaults release]; ================ ...

Angular2-ui-switch发出错误(Angular2-ui-switch Giving an error)

您没有将模块添加到systemjs.config.js我猜 在地图中添加: 'angular2-ui-switch': 'npm:angular2-ui-switch' 并在包中: 'angular2-ui-switch': { main: 'node_modules/angular2-ui-swith-main-class-to-find' defaultExtension: 'js', } You didn't add the module to your systemjs ...

相关文章

更多

最新问答

更多
  • 如何在CSS中进行自定义文本编辑并在学校项目中获取错误(How to do custom text editing in CSS and getting a error in a school project)
  • 获取列表中最长的元素(Get the longest element of a list)
  • Files.copy(Path,Path)是否创建目录?(Does Files.copy(Path,Path) create directories?)
  • 如何在ajax请求完成后1秒递归调用函数?(How to recursively call a function 1 second after an ajax request is done?)
  • 如何统计销售量,城市,商品使用情况的客户oracle(How to statistics sales, city, customer of goods use oracle)
  • 无法从命令行覆盖pom maven-surefire-plugin(Cannot overwrite pom maven-surefire-plugin from command line)
  • 根据Select2 4.0中的值应用css类(Applying css class according to value in Select2 4.0)
  • 使用Jackson(Polymorphic)进行反序列化时缺少字段(Missing field when deserializing using Jackson (Polymorphic))
  • 使用PHP的即时警报通知功能(Instant Alert notification feature using PHP)
  • 与以前的密码相比(Comparing with previous passwords)
  • 从现金流中获取特定行(Getting specific line from Cash Flow)
  • Citrix:无法使用MDKToolkit包装apk(Citrix: can't wrap apk using MDKToolkit)
  • 流星角色包的灵活性如何?(How flexible is meteor-roles package?)
  • 带有多个按钮的Google扩展程序(Google Extension with more than one button in the toolbar)
  • php setTimezone同时出现不同的结果(php setTimezone different result for the same time)
  • 搜索不使用jQuery调用json(Search not working using jQuery with call to json)
  • 如何打印文件的内容?(How do I print out the contents of a file? C++ File Stream)
  • Django自定义包含标签(Django Custom Inclusion Tags)
  • Java Jtree mouseEvent如果没有选择任何内容(Java Jtree mouseEvent if nothing is selected)
  • 通过哈希对象循环获取次数(Get number of times in loop over Hash object)
  • Python转义序列复杂输出(Python escape sequence complex output)
  • 将列表对象中的字符串转换为逗号分隔(Convert string in list objects to comma separated)
  • 如何限制特定字符在laravel 5.4中的字符串?(How to limit string in laravel 5.4 from specific char?)
  • 如何从浏览器调用appengine servlet(how to call appengine servlet from browser)
  • Excel条件格式更改整个行颜色(Excel conditional formatting to change entire row color)
  • 在JTable中显示数据库中的数据(Displaying data from database in JTable)
  • 在android中附加文件的问题(Issue on appending a file in android)
  • 在数组中输入值(Make in input value as in array)
  • Haml + ActionMailer - Rails?(Haml + ActionMailer - Rails?)
  • 在tomcat上部署的grails war没有连接到数据库(grails war deployed on tomcat is not connecting to database)