@fivethree/ngxs-ionic-router-plugin

NGXS Ionic Router Plugin

Usage no npm install needed!

<script type="module">
  import fivethreeNgxsIonicRouterPlugin from 'https://cdn.skypack.dev/@fivethree/ngxs-ionic-router-plugin';
</script>

README

IonicRouterPlugin for NGXS

npm version License

Router Plugin for Ionic 5 and NGXS 3.7.1 or higher.

Angular @ngxs/store ionic @fivethree/@fivethree/ngxs-ionic-router-plugin
11 3.7.1+ 5.x.x 1.0.0
8/9 3.6.x+ 5.x.x 0.3.x
8/9 3.6.x+ 4.x.x 0.2.x
7 3.3.4+ 4.x.x 0.1.0

📦 Installation

npm install @fivethree/ngxs-ionic-router-plugin --save

# or if you are using yarn
yarn add @fivethree/ngxs-ionic-router-plugin

🔨 Usage

Import the module into your root application module:

import { NgModule } from '@angular/core';
import { NgxsModule } from '@ngxs/store';
import { NgxsIonicRouterPluginModule } from '@fivethree/ngxs-ionic-router-plugin';

@NgModule({
  imports: [NgxsModule.forRoot(states), NgxsIonicRouterPluginModule.forRoot()]
})
export class AppModule {}

Now the route will be reflected in your store under the ionicRouter state name.

🧭 Navigation

new NavigateRoot(path: string | UrlTree | any[], options?: NavigationOptions)

new NavigateForward(path: string | UrlTree | any[], options?: NavigationOptions)

new NavigateBackward(path: string | UrlTree | any[], options?: NavigationOptions)

new NavigateBack(options?: AnimationOptions)