ionic - export 'IonicStorageModule' was not found in '#ionic/storage' - ionic-framework

I want to use storage in ionic (based on angular), so I did all that described here: https://ionicframework.com/docs/v3/storage/ and import it like this:
import { IonicStorageModule } from '#ionic/storage';
but I get this error:
export 'IonicStorageModule' was not found in '#ionic/storage'
My ionic version is 6.13.1.

The use of storage was changed in ionic and now you need to import it as following:
import { IonicStorageModule } from '#ionic/storage-angular';
As described in details here: https://github.com/ionic-team/ionic-storage

For angular need to install as
npm install --save #ionic/storage-angular
Then
import { IonicStorageModule } from '#ionic/storage-angular';

Related

export 'CHART_TOOL_PANEL_ALLOW_LIST' (imported as 'CHART_TOOL_PANEL_ALLOW_LIST') was not found in 'ag-grid-community'

We are changing an Ag Grid Community component to Enterprise, for which we ran the respective npm command
npm install --save ag-grid-enterprise
added the import to the enterprise
import { AgGridReact } from 'ag-grid-react';
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
import 'ag-grid-enterprise';
import 'ag-grid-community/dist/styles/ag-grid.css';
the expectation was we get enterprise features onboard but now we get to see some error
package.json also looks fine
Found the solution for this issue, this was happening because we need to have the same version of ag-grid-community and ad-grid-enterprise once upgraded both of them to V29, then it worked like a charm.

module in material-ui not longer found

It's been running fine for several months now, but since I've re-installed the node_modules folder I got this error.
Module not found: Can't resolve 'final-form-material-ui/dist' in '....'
package.json
...
"dependencies": {
"#material-ui/core": "^3.9.3",
"#material-ui/icons": "^3.0.2",
...
In the component, i use:
import {TextField, Input} from 'final-form-material-ui/dist';
And in the node_modules/final-form-material-ui/dist folder I do have the TextField.d.ts and the Input.d.ts files.
Any clues?
You need to import the right package from #material-ui/core.
import {TextField, Input} from '#material-ui/core';
changed as suggested / asked / queried by HRK44
import {TextField, Input} from '#material-ui/core';

No Provider For Paypal Error is showing in my Ionic App

I am working in my Ionic app and I have just installed the PayPal plugin for my Ionic App.
Used These for adding the plugin.
ionic cordova plugin add com.paypal.cordova.mobilesdk
npm install #ionic-native/paypal
I have also import in my checkout.ts:
import { PayPal, PayPalPayment, PayPalConfiguration } from '#ionic-native/paypal/ngx';
constructor(private payPal: PayPal) { }
But after adding this, it is showing the error: No Provider for PayPal.
Then I have added it to the app.module.ts:
import { PayPal, PayPalPayment, PayPalConfiguration } from '#ionic-native/paypal';
providers: [PayPal]
But after adding the PayPal to the Provider, it is showing the error:
Type 'PayPalOriginal' is not assignable to type 'Provider'. Type
'PayPalOriginal' is missing the following properties from type
'FactoryProvider': provide.
Any help is much appreciated.
In the checkout.ts you are importing correctly,
import { PayPal, PayPalPayment, PayPalConfiguration } from
'#ionic-native/paypal/ngx';
But in the app.module.ts the import path is wrong
import { PayPal, PayPalPayment, PayPalConfiguration } from '#ionic-native/paypal';
You have to import like the one you did in checkout.ts file. ngx is missing in app.module.ts file

How do you add Font Awesome to Ionic 4

There are a lot of tutorials and articles of how to include Font Awesome in an Ionic 3 project but I struggled finding any on how to add Font Awesome into an Ionic 4 project. So this poses the question, how do you add and use Font Awesome in an Ionic 4 project?
I have tried using the following tutorial without much success. I tried following the steps outlined in the following StackOverflow answer which did not work either.
To get Font Awesome working in an Ionic 4 project you can follow the steps below.
Firstly, you need to install all the npm packages, the first two are required but you can decide whether you need the solid, regular or brands icons, I will be using all of them. Go ahead and execute the following npm commands in your terminal:
npm i --save #fortawesome/fontawesome-svg-core
npm i --save #fortawesome/angular-fontawesome
npm i --save #fortawesome/free-solid-svg-icons
npm i --save #fortawesome/free-regular-svg-icons
npm i --save #fortawesome/free-brands-svg-icons
Once you have done that, navigate to your app.module.ts in your project and add the following:
import { FontAwesomeModule } from '#fortawesome/angular-fontawesome';
import { library } from '#fortawesome/fontawesome-svg-core';
Depending on which font packages you installed, add the following:
import { fas } from '#fortawesome/free-solid-svg-icons';
import { far } from '#fortawesome/free-regular-svg-icons';
import { fab } from '#fortawesome/free-brands-svg-icons';
Once they have been imported at the top of your file you will need to include the FontAwesomeModule in your imports:
.....
imports: [...., FontAwesomeModule],
.....
Once again, depending on what icons you chose you will need to add them to the Font Awesome library that was imported earlier. Add this underneath your last import (above #NgModule()):
library.add(fas, far, fab);
Then navigate to the module of the page that you would like to use the fonts in i.e. home.module.ts and then import and add the FontAwesomeModule:
import { FontAwesomeModule } from '#fortawesome/angular-fontawesome'
....
#NgModule({
imports: [
...
FontAwesomeModule
...
],
})
Then finally you can use the icon in that page's HTML by inserting the following where you'd like the icon:
<fa-icon [icon]="['fas', 'graduation-cap']" slot="end"></fa-icon>
You can replace, fas with the correct library i.e. far, fas & fab and then the name of the icon, which in this case was graduation-cap.
Run the following command:
npm install --save-dev #fortawesome/fontawesome-free
Then, in angular.json append this on "styles":
{
"input": "node_modules/#fortawesome/fontawesome-free/css/all.css"
}
Just in case if someone deals with FontAwesome PRO. I've recently bought FontAwesome pro icons and integreted them like this:
copy the FontAwesome webfonts folder in src/assets/
copy the FontAwesome scss folder in src/theme/
change the $fa-font-path in _variables.scss with assets/webfonts !default;
add in global.scss
#import './theme/[YourDirectoryfontawesomeScss]/fontawesome.scss';
#import './theme/[YourDirectoryfontawesomeScss]/solid.scss';
#import './theme/[YourDirectoryfontawesomeScss]/brands.scss';
#import './theme/[YourDirectoryfontawesomeScss]/light.scss';
#import './theme/[YourDirectoryfontawesomeScss]/regular.scss';
Finally you can use them with the i tag. For example
<i class="fas fa-stack-overflow"></i>
you can find more details about the fa- classes here
https://fontawesome.com/how-to-use/on-the-web/setup/getting-started
I was racking my brain trying to get this working with Ionic 5/Angular 10 and couldn't get it working. I figured it in the end, should anyone else require it.
For Ionic 5/Angular 10
Run ng add #fortawesome/angular-fontawesome#latest in your project folder and select the icons you require.
In app.module.ts add the following:
import { FaIconLibrary, FontAwesomeModule } from '#fortawesome/angular-fontawesome';
import { fas } from '#fortawesome/free-solid-svg-icons'; //Solid icons
import { far } from '#fortawesome/free-regular-svg-icons'; // Regular icons
import { fab } from '#fortawesome/free-brands-svg-icons'; // Brand icons
And import FontAwesomeModule to the imports declarables so it looks like this:
#NgModule({
declarations: [AppComponent],
entryComponents: [],
imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule, FontAwesomeModule],
providers: [
StatusBar,
SplashScreen,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
],
bootstrap: [AppComponent],
})
And then export a library constructor as so...
export class AppModule {
constructor(library: FaIconLibrary) {
library.addIconPacks(fas, far, fab);
}
}
Go to the module you wish to use Font Awesome (e.g. mypage.module.ts) and import the FontAwesomeModule.
Finally in your HTML, e.g. mypage.page.html simply use <fa-icon icon="home"></fa-icon> to display an icon.
If you run in to any issues, make sure you stop Ionic first and run ionic serve again as this should recompile the framework.
Also take a look at https://github.com/FortAwesome/angular-fontawesome/blob/master/docs/usage/features.md for a full list of the features available in its usage.
The easiest way for the Angular user is to write ng add #fortawesome/angular-fontawesome#latest

IONIC 3: Plugin BackgroundMode dont work: Object(…) is not a function

I need to run the code “this.backgroundMode.enable()” in my project, but it shows me the following error:
"Object(...) is not a function"
It imports it in app.module.ts in the following way:
import {BackgroundMode} from '# ionic-native / background-mode / ngx';
...
providers: [
...
BackgroundMode
...]
And in the page (in my case is in app.component.ts, after deviceready, like the official documentation says) i use like:
import {BackgroundMode} from '# ionic-native / background-mode / ngx';
constructor(private backgroundMode: BackgroundMode) { }
...
this.backgroundMode.enable();
Please I need to run this plugin in my project
I have answered a similar question here https://stackoverflow.com/a/54398403/6617276
Check your project type in ionic.config.json file.
If the type is "ionic-angular", then install 4.x.x version.
npm i -s #ionic-native/background-mode#4.20.0
If the type is "angular", then install 5.x.x-beta version
npm i -s #ionic-native/background-mode#5.0.0-beta.24
Note:
Add ngx at the end of import only if you are using Angular 6
import { BackgroundMode } from '#ionic-native/background-mode/ngx';
if not remove ngx from the import both in app.module.ts and app.component.ts
import { BackgroundMode } from '#ionic-native/background-mode';