मैं फ्लेक्स-लेआउट कैसे शामिल करूं


10

मैं एक कोणीय ऐप में फ्लेक्स-लेआउट को जोड़ने की कोशिश कर रहा हूं, लेकिन जब मैं करता हूं और इसका उपयोग करने की कोशिश करता हूं तो ऐप टूट जाता है। मैंने स्थापित किया है

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

फिर app.module.ts में आयात किया गया

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

import [ FlexLayoutModule ]

मैंने नवीनतम में टाइपस्क्रिप्ट को भी अपग्रेड किया है

npm i typescript@latest

लेकिन जब एप्लिकेशन संकलन करने की कोशिश करता है, तो मुझे सभी प्रकार की त्रुटियां मिलती हैं:

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.

और सूची खत्म ही नहीं होती। क्या मेरे पास किसी चीज़ का संस्करण बेमेल है?

धन्यवाद.....


या टाइपस्क्रिप्ट संस्करण हो सकता है>
प्रशांत पिंपले

जवाबों:


7

निर्भरता में tslib जोड़ने की कोशिश करें

npm install --save tslib

संपादित करें

यदि आप कोणीय v8 का उपयोग कर रहे हैं तो फ्लेक्स-लेआउट के लिए v8 का उपयोग करें क्योंकि v9 को कोणीय v9 की आवश्यकता है।


कोई परिवर्तन नहीं होता है। पहले की तरह ही त्रुटियां।
cpeddie

3
कोई व्यक्ति पहले से ही TS1086 त्रुटि के लिए समस्या उठाता है। इसे और इसके समाधान पर लूट । उत्तर हैv9 requires Angular v9 and more importantly TypeScript v3.7. Please use the v8 release of Flex Layout.
रत्नदीप भट्टाचार्य

वह यह था। फ्लेक्स लेआउट का गलत संस्करण।
कोपेडी

25

यह इसलिए है क्योंकि आप कोणीय 8 पर हैं, लेकिन पुस्तकालय को कोणीय 9 की आवश्यकता है। आपके पैकेज में। इस संस्करण का उपयोग करें: "@angular/flex-layout": "^8.0.0-beta.27"


धन्यवाद, यह मेरे लिए काम करता है!
user3856842
हमारी साइट का प्रयोग करके, आप स्वीकार करते हैं कि आपने हमारी Cookie Policy और निजता नीति को पढ़ और समझा लिया है।
Licensed under cc by-sa 3.0 with attribution required.