Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

281
Views
How do I include flex-layout?

I am trying to add flex-layout to an angular app, but when I do and try to use it the app breaks. I have installed

npm i @angular/flex-layout @angular/cdk

then imported in app.module.ts

import { FlexLayoutModule } from '@angular/flex-layout';

import [ FlexLayoutModule ]

I've also upgraded typescript to the latest

npm i typescript@latest

But when the app tries to compile, I get all kinds of errors:

ERROR in node_modules/@angular/flex-layout/core/typings/base/base2.d.ts:24:19 - error TS1086: An accessor cannot be declared in an ambient context.

24     protected get parentElement(): HTMLElement | null;
                 ~~~~~~~~~~~~~
node_modules/@angular/flex-layout/core/typings/base/base2.d.ts:26:19 - error TS1086: An accessor cannot be declared in an ambient context.

26     protected get nativeElement(): HTMLElement;
                 ~~~~~~~~~~~~~
node_modules/@angular/flex-layout/core/typings/base/base2.d.ts:28:9 - error TS1086: An accessor cannot be declared in an ambient context.

28     get activatedValue(): string;
       ~~~~~~~~~~~~~~
node_modules/@angular/flex-layout/core/typings/base/base2.d.ts:29:9 - error TS1086: An accessor cannot be declared in an ambient context.

29     set activatedValue(value: string);
       ~~~~~~~~~~~~~~
node_modules/@angular/flex-layout/core/typings/breakpoints/break-point-registry.d.ts:20:9 - error TS1086: An accessor cannot be declared in an ambient context.

20     get overlappings(): BreakPoint[];
       ~~~~~~~~~~~~
node_modules/@angular/flex-layout/core/typings/breakpoints/break-point-registry.d.ts:24:9 - error TS1086: An accessor cannot be declared in an ambient context.

and the list goes on. Do I have a version mismatch of something?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

It's because you are on Angular 8 but the library required Angular 9. In your package.json use this version : "@angular/flex-layout": "^8.0.0-beta.27"

over 4 years ago · Santiago Trujillo Report

0

Try to add tslib in dependencies

npm install --save tslib

Edit

If you are using Angular v8 then use v8 for flex-layout cause v9 need Angular v9.

over 4 years ago · Santiago Trujillo Report

0

  1. Change version of flex-layout compatible with Angular 8. update angular.json
"@angular/flex-layout": "^8.0.0-beta.27"
  1. install this update
npm install

To avoid this error update tsconfig.json (Not recommended)

"compilerOptions": {
   "skipLibCheck":true
}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!