Closed azherf closed 4 years ago
in rxjs 6.x, u should use pipe? like this
import { Subject } from 'rxjs';
import { filter, map } from 'rxjs/operators';
class Sub {
_eventBus: Subject<any>;
constructor() {
this._eventBus = new Subject();
}
broadcast(key: any, data: any) {
this._eventBus.next({key, data})
}
on(key: any) {
this._eventBus.asObservable().pipe(
filter(event => event.key === key),
map(event => event.data)
);
}
}
Hi @chenc041 ,
I thought too, but the same code, without pipe is working fine in Angular 9.
With the following dependencies it works perfectly fine. rxjs is 6.x.
"dependencies": {
"@angular/animations": "^9.1.0",
"@angular/cdk": "^9.2.0",
"@angular/common": "~9.1.0",
"@angular/compiler": "~9.1.0",
"@angular/core": "~9.1.0",
"@angular/forms": "~9.1.0",
"@angular/http": "~7.2.4",
"@angular/localize": "^9.1.0",
"@angular/material": "^9.2.0",
"@angular/material-moment-adapter": "^9.2.0",
"@angular/platform-browser": "~9.1.0",
"@angular/platform-browser-dynamic": "~9.1.0",
"@angular/pwa": "^0.801.2",
"@angular/router": "~9.1.0",
"@ng-bootstrap/ng-bootstrap": "^4.0.0",
"@swimlane/ngx-charts": "^14.0.0",
"angular-gridster2": "^8.2.0",
"angular2-query-builder": "^0.6.0",
"angular2-uuid": "^1.1.1",
"bootstrap": "^4.2.1",
"classlist.js": "^1.1.20150312",
"core-js": "^2.5.4",
"element-remove": "^1.0.4",
"es6-promise": "^4.2.8",
"font-awesome": "^4.7.0",
"hammerjs": "^2.0.8",
"jquery": "^3.5.1",
"moment": "^2.22.2",
"ng-broadcaster": "^7.0.1",
"ngx-bootstrap": "^5.1.1",
"rxjs": "~6.5.4",
"rxjs-compat": "^6.3.3",
"taxilla-library": "2.6.0-beta.8",
"web-animations-js": "^2.3.2",
"zone.js": "~0.10.2",
"cross-storage": "^1.0.0",
"crypto-js": "^3.1.9-1",
"pbkdf2": "^3.0.17",
"ngx-webstorage-lppedd": "^99.0.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.901.0",
"@angular/cli": "~9.1.0",
"@angular/compiler-cli": "^9.1.0",
"@angular/language-service": "~9.1.0",
"@types/bootstrap": "^4.1.2",
"@types/cross-storage": "^0.8.29",
"@types/crypto-js": "^3.1.43",
"@types/fontfaceobserver": "0.0.6",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/jquery": "^3.5.0",
"@types/node": "~10.12.19",
"@types/pbkdf2": "^3.0.0",
"node-sass": "^4.12.0",
"codelyzer": "~4.5.0",
"express": "^4.16.4",
"fontfaceobserver": "^2.1.0",
"jasmine-core": "~3.3.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^4.0.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"transformation-matrix": "^1.7.0",
"ts-node": "~8.0.2",
"tslint": "~6.1.0",
"typescript": "~3.7.5",
"webcola": "^3.3.8",
"webpack-bundle-analyzer": "^3.8.0"
}
This is due to rxjs-compat no longer being supported in Angular 10. The side-effecful module imports to register operators on the Observable
prototype all require rxjs-compat, as this mode of operation has been removed in RxJS 6 (which Angular adopted in its v6, coincidentally.) Probably there's some dependency that's still depending on it (the screenshot hints at ng-broadcaster, as it does contain such imports).
There's some earlier issues like this but I can't seem to find them right away.
Finally got Github to find me the related issues: #18213, #18052, #18045 and #18035.
@alan-agius4 can this be documented as breaking change somewhere?
@JoostK, not that I am aware of.
Added a note in the release page https://github.com/angular/angular-cli/releases/tag/v10.0.0
Thanks @alan-agius4 and @JoostK .
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
π bug report
Affected Package
The issue is caused by package "@angular-devkit/build-angular": "^0.1000.3" and "ng-broadcaster": "^7.0.1", ### Description We recently upgraded to Angular 10. That started giving us one js error in ng-broadcaster. The error does not show up when we run `npm start`. Only when we do a production build and deploy it, this error is coming up. ## π₯ Exception or Errorπ Your Environment
package.json using which the error is coming up:
In the above package.json, we tried building with different
build-angular
plugins like 0.1000.1, 0.1000.2 and 0.1000.3. Nothing worked. If we go back tothe error is not coming but the app builds with many warnings.
What could be the issue here ? Is it angular related or our app related ?
Thanks for help.