【发布时间】:2017-02-01 02:43:30
【问题描述】:
我在 Angular 2 final 和 Angular-cli 中使用 observables。
- Angular 2.0.0 最终版
- angular-cli: 1.0.0-beta.15
- 节点:6.3.0
- Mac 操作系统:el capitan
package.json 中的依赖项:
"dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/router": "3.0.0",
"bootstrap-sass": "^3.3.7",
"chart.js": "^2.2.2",
"core-js": "^2.4.1",
"d3": "^4.2.3",
"d3-tip": "^0.7.1",
"ionicons": "^3.0.0",
"moment": "^2.15.1",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "^1.1.1",
"zone.js": "^0.6.23"
}
我的应用程序在除 Safari 9.1.2 之外的所有浏览器中都能正常运行 - 它会将此错误消息抛出到控制台:
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:4200/Observable.js.map
我尝试在 angular_cli.json 中导入 Rxjs:
"scripts": [
"../node_modules/rxjs/Rx.js"
],
另外,我尝试将 rxjs 导入到 app.module.ts 和这样的工作组件中:
import {Observable} from 'rxjs/Rx';
但总是遇到同样的错误。
我做错了吗? 很奇怪只有Safari会遇到这个错误。
【问题讨论】:
-
我在 ios 8.3 上运行的 Ionic 应用也遇到了同样的问题,你解决了吗?
-
我也有同样的问题,你解决了吗?
标签: angular angular-cli rxjs5 angular2-observables