@ngrx/router-store

WebJar for @ngrx/router-store

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

ngrx__router-store
Последняя версия

Последняя версия

1.2.5
Дата

Дата

Тип

Тип

jar
Описание

Описание

@ngrx/router-store
WebJar for @ngrx/router-store
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/ngrx/router-store

Скачать ngrx__router-store

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/ngrx__router-store/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>ngrx__router-store</artifactId>
    <version>1.2.5</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/ngrx__router-store/
implementation 'org.webjars.npm:ngrx__router-store:1.2.5'
// https://jarcasting.com/artifacts/org.webjars.npm/ngrx__router-store/
implementation ("org.webjars.npm:ngrx__router-store:1.2.5")
'org.webjars.npm:ngrx__router-store:jar:1.2.5'
<dependency org="org.webjars.npm" name="ngrx__router-store" rev="1.2.5">
  <artifact name="ngrx__router-store" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='ngrx__router-store', version='1.2.5')
)
libraryDependencies += "org.webjars.npm" % "ngrx__router-store" % "1.2.5"
[org.webjars.npm/ngrx__router-store "1.2.5"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

This repository is for version 1.x of of @ngrx/router-store.

Click here for the latest version (4.x)


@ngrx/router-store

Bindings to connect angular/router to ngrx/store

Join the chat at https://gitter.im/ngrx/store

Installation

npm install @ngrx/router-store@1.2.6 --save

Setup

  1. Use the routerReducer when providing the StoreModule.provideStore and add the RouterStoreModule.connectRouter to the @NgModule.imports:
import { StoreModule } from '@ngrx/store';
import { routerReducer, RouterStoreModule } from '@ngrx/router-store';

@NgModule({
  imports: [
    BrowserModule,
    StoreModule.provideStore({ router: routerReducer }),
    RouterStoreModule.connectRouter()
  ],
  bootstrap: [ AppComponent ]
})
export class AppModule {
}
  1. Add RouterState to main application state:
import { RouterState } from '@ngrx/router-store';

export interface AppState {
  router: RouterState;
};
  1. (Optional) Set the initial value for the router state:
StoreModule.provideStore({ router: routerReducer }, {
  router: {
    path: window.location.pathname + window.location.search
  }
})

Dispatching Actions

import { go, replace, search, show, back, forward } from '@ngrx/router-store';

Navigation with a new state into history

store.dispatch(go(['/path', { routeParam: 1 }], { query: 'string' }));

Navigation with replacing the current state in history

store.dispatch(replace(['/path'], { query: 'string' }));

Navigation without pushing a new state into history

store.dispatch(show(['/path'], { query: 'string' }));

Navigation with only changing query parameters

store.dispatch(search({ query: 'string' }));

Navigating back

store.dispatch(back());

Navigating forward

store.dispatch(forward());

Navigation Extras

The Angular Router Navigation Extras are supported with each router action.

import { NavigationExtras } from '@angular/router';

let extras: NavigationExtras = {
  relativeTo: ActivatedRoute,
  fragment: string,
  preserveQueryParams: boolean,
  preserveFragment: boolean,
  skipLocationChange: boolean,
  replaceUrl: boolean
};

store.dispatch(go(['path', { routeParam: 1 }], { query: 'string' }, extras));
org.webjars.npm

ngrx

Reactive Extensions for Angular

Версии библиотеки

Версия
1.2.5