Flex-layout: MatchMediaObservable : Upgrade from 2.0.0-beta.1 to 2.0.0-beta.3

Created on 23 Jan 2017  路  12Comments  路  Source: angular/flex-layout

I tried to upgrade from 2.0.0-beta.1 to 2.0.0-beta.3 and it now breaks saying that :
EXCEPTION: Uncaught (in promise): Error: Error in :0:0 caused by: this.media$.map is not a function TypeError: this.media$.map is not a function

My code :

constructor(@Inject(MatchMediaObservable) public media$) { }

this.media$
  .map((change: MediaChange) => { ... });

I looked in release notes and changelog but couldn't find anything about breaking change.

bug has pr in-progress

Most helpful comment

@maxime1992 - we will investigate. Thank you.

All 12 comments

@maxime1992 - we will investigate. Thank you.

This works using the following in package.json:

  "dependencies": {
    "@angular/flex-layout": "^2.0.0-beta.3",
}

@ThomasBurleson I tried to do that but I still have the same error.

Are you importing the rxjs map operator?

Are you importing the RxJS map operator ?

`js import 'rxjs/add/operator/map';

Here's what I import :

// statics
import 'rxjs/add/observable/throw';
// operators
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/delay';
import 'rxjs/add/operator/debounceTime';
import 'rxjs/add/operator/distinctUntilChanged';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/let';
import 'rxjs/add/operator/switchMap';
import 'rxjs/add/operator/toPromise';
import 'rxjs/add/operator/withLatestFrom';
import 'rxjs/add/operator/combineLatest';

// observables
import 'rxjs/add/observable/empty';

So yes I do have map operator.

@maxime1992 - It is almost impossible to support issues with Plunkrs that our team can use to reproduce the issue. Unless you have a Plunkr that demonstrates this problem, I will be forced to close this issue.

Plunkrs and source are critical to fast resolutions.

@maxime1992 - My apologies sir. The issue is within flex-layout: MatchMediaObservable is not a real observable. It is a wrapper around the observable because we expose a isActive(<alias>) method also.

This means the RxJS operators will NOT work because the reference is not a real observable.

I think the API for MatchMediaObservable needs to some work.

This will be fixed within the next 1-2 days. Thank you.

@ThomasBurleson I usually try to help as much as I can by giving a Plunkr but as I really thought it was no big deal I didn't provide one this time.

No problem, thank you for being so reactive :smile:

Cheers :beers:

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._

Was this page helpful?
0 / 5 - 0 ratings