Flex-layout: Angular 5 support

Created on 1 Nov 2017  路  6Comments  路  Source: angular/flex-layout

Right now flex-layout uses deprecated OpaqueToken. It prevents us from upgrading app that uses Angular 4 to Angular 5.

Bug, feature request, or proposal:

Make flex-layout work with Angular 5.

What is the expected behavior?

Angular application that was upgraded to Angular 5 is served or built successfully.

What is the current behavior?

ERROR in /%PATH_TO_NODE_MODULES%/node_modules/@angular/flex-layout/media-query/breakpoints/break-points.d.ts (8,10): Module '"/%PATH_TO_NODE_MODULES%/node_modules/@angular/core/core"' has no exported member 'OpaqueToken'.

Most helpful comment

@Splaktar @mrsan22 thanks for your help. I actually resolved the issue.

Problem was that before updating to angular 5, I had "@angular/flex-layout": "^2.0.0-rc.1" in package.json. After update I changed it to "@angular/flex-layout": "^2.0.0-beta.10", and installed packages, but npm somehow concluded that flex-layout doesn't need to be upgraded.

Change to "@angular/flex-layout": "2.0.0-beta.10",, removal of node_modules and npm install made it work.

All 6 comments

I changed my import of FlexModule from this:

FlexLayoutModule.forRoot()

To this:

FlexLayoutModule

And re-ran ng serve and it seems like the error is gone, at least for me, using Flex layout beta 10 and Angular CLI 1.5 RC 8.

What version are you on? https://github.com/angular/flex-layout/blob/master/CHANGELOG.md#200-beta10-2017-10-31 is out (since yesterday) and supports Angular v5.

@esmeneev - Latest Flex-Layout already uses InjectionToken. check here. I would suggest doing a reinstall of flex-layout 2.0.0-beta.10

I don't know how, but I had an rc.1 installed which is "later" than beta.10, so looking in my package lock file (using a recent version of npm! also I think shrinkwrap does this) showed me that. I blew away my node modules folder for it and reinstalled but it grabbed the rc from my machine's npm cache. I need to go but I assume this is the issue (RC being older than beta 10 and the dep being specified like "@angular/flex-layout": "^2.0.0-beta.10". I'll update once I test in the morning.

@Splaktar @mrsan22 thanks for your help. I actually resolved the issue.

Problem was that before updating to angular 5, I had "@angular/flex-layout": "^2.0.0-rc.1" in package.json. After update I changed it to "@angular/flex-layout": "^2.0.0-beta.10", and installed packages, but npm somehow concluded that flex-layout doesn't need to be upgraded.

Change to "@angular/flex-layout": "2.0.0-beta.10",, removal of node_modules and npm install made it work.

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