我在 Angular 2 final 和 Angular-cli 中使用 observables。
- Angular 2.0.0 最终版
- 角-cli:1.0.0-beta.15
- 节点:6.3.0
- Mac 操作系统: el capan
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 会遇到这个错误。