All Projects → ngneat → elf-ng-router-store

ngneat / elf-ng-router-store

Licence: other
Bindings to connect Angular router to Elf

Programming Languages

typescript
32286 projects
HTML
75241 projects
javascript
184084 projects - #8 most used programming language
SCSS
7915 projects

Projects that are alternatives of or similar to elf-ng-router-store

elfloader
ARMv7M ELF loader
Stars: ✭ 71 (+255%)
Mutual labels:  elf
abireport
Tool to create ABI reports from ELF binaries in packaging
Stars: ✭ 16 (-20%)
Mutual labels:  elf
atomic-state
Atomic State is a state management library for React
Stars: ✭ 15 (-25%)
Mutual labels:  state
csc picker
A flutter package to display a country, states, and cities. In addition it gives the possibility to select a list of countries, States and Cities depends on Selected, also you can search country, state, and city all around the world.
Stars: ✭ 25 (+25%)
Mutual labels:  state
ballotnav
A repository for HackforLA's BallotNav project
Stars: ✭ 21 (+5%)
Mutual labels:  state
ngx-online-status
🔛 Angular 5+ Detect online/offline state
Stars: ✭ 23 (+15%)
Mutual labels:  state
gdb-memstr
Generate arbitrary strings out of contents of ELF sections
Stars: ✭ 13 (-35%)
Mutual labels:  elf
XUI
XUI makes modular, testable architectures for SwiftUI apps a breeze!
Stars: ✭ 100 (+400%)
Mutual labels:  state
React-Machinery
🔥 React Machinery provides a simple to use, component based approach to state machines in react.
Stars: ✭ 104 (+420%)
Mutual labels:  state
storken
🦩 Storken is a React State Manager. Simple as `useState`.
Stars: ✭ 22 (+10%)
Mutual labels:  state
ELFPatch
A library for patching ELFs
Stars: ✭ 46 (+130%)
Mutual labels:  elf
elf-stuff
Compilation of ELF Packers and ELF obfuscation / Anti-Debugging stuff
Stars: ✭ 20 (+0%)
Mutual labels:  elf
dcc
Direct/Interactive C Compiler
Stars: ✭ 18 (-10%)
Mutual labels:  elf
react-redux-modals
This repo created for Medium.com: React/Redux: Modals and Dialogs
Stars: ✭ 30 (+50%)
Mutual labels:  state
binary-security-check
Analyzer of security features in executable binaries
Stars: ✭ 36 (+80%)
Mutual labels:  elf
dipa
dipa makes it easy to efficiently delta encode large Rust data structures.
Stars: ✭ 243 (+1115%)
Mutual labels:  state
StateBuilder
State machine code generator for C++ and Java.
Stars: ✭ 30 (+50%)
Mutual labels:  state
stateware
Smart state container with easy copy and auto memoized getters
Stars: ✭ 20 (+0%)
Mutual labels:  state
belf
Balika011's PlayStation 4 ELF loader for IDA Pro 7.0/7.1
Stars: ✭ 31 (+55%)
Mutual labels:  elf
telfhash
Symbol hash for ELF files
Stars: ✭ 75 (+275%)
Mutual labels:  elf

Angular Router Store

Bindings to connect Angular router to Elf store.

To get started, install the @ngneat/elf-ng-router-store package and add to the AppModule the Elf’s devtools modules:

import { ElfNgRouterStoreModule } from '@ngneat/elf-ng-router-store';

@NgModule({
imports: [
  ElfNgRouterStoreModule
})
export class AppModule {
}

With this setup, you'll get two things:

  1. You'll see the Router actions in Redux devtools.
  2. A unique set of selectors to query the router state:

selectParams

import { RouterRepository } from '@ngneat/elf-ng-router-store';

export class UsersRepository {
   constructor(private routerRepository: RouterRepository) {
     routerRepository.selectParams().subscribe();
     routerRepository.selectParams('id').subscribe();
     routerRepository.selectParams(['id', 'type']).subscribe();
   }
}

getParams

import { RouterRepository } from '@ngneat/elf-ng-router-store';

export class UsersRepository {
   constructor(private routerRepository: RouterRepository) {
     const params = routerRepository.getParams()
   }
}

selectQueryParams

import { RouterRepository } from '@ngneat/elf-ng-router-store';

export class UsersRepository {
   constructor(private routerRepository: RouterRepository) {
     routerRepository.selectQueryParams().subscribe();
     routerRepository.selectQueryParams('redirectTarget').subscribe();
     routerRepository.selectQueryParams(['redirectTarget', 'type']).subscribe();
   }
}

getQueryParams

import { RouterRepository } from '@ngneat/elf-ng-router-store';

export class UsersRepository {
   constructor(private routerRepository: RouterRepository) {
     const redirectTarget = routerRepository.getQueryParams().redirectTarget
   }
}

selectFragment

import { RouterRepository } from '@ngneat/elf-ng-router-store';

export class UsersRepository {
   constructor(private routerRepository: RouterRepository) {
     routerRepository.selectFragment().subscribe();
   }
}

getFragment

import { RouterRepository } from '@ngneat/elf-ng-router-store';

export class UsersRepository {
   constructor(private routerRepository: RouterRepository) {
     const fragment = routerRepository.getFragment()
   }
}

selectData

import { RouterRepository } from '@ngneat/elf-ng-router-store';

export class UsersRepository {
   constructor(private routerRepository: RouterRepository) {
     routerRepository.selectData().subscribe();
     routerRepository.selectData('id').subscribe();
     routerRepository.selectData(['id', 'type']).subscribe();
   }
}

getData

import { RouterRepository } from '@ngneat/elf-ng-router-store';

export class UsersRepository {
   constructor(private routerRepository: RouterRepository) {
     const data = routerRepository.getData()
   }
}

selectNavigationExtras

import { RouterRepository } from '@ngneat/elf-ng-router-store';

export class UsersRepository {
   constructor(private routerRepository: RouterRepository) {
     routerRepository.selectNavigationExtras().subscribe();
     routerRepository.selectNavigationExtras('id').subscribe();
     routerRepository.selectNavigationExtras(['id', 'type']).subscribe();
   }
}

getNavigationExtras

import { RouterRepository } from '@ngneat/elf-ng-router-store';

export class UsersRepository {
   constructor(private routerRepository: RouterRepository) {
     const extras = routerRepository.getNavigationExtras()
   }
}

selectNavigationCancel

import { RouterRepository } from '@ngneat/elf-ng-router-store';

export class UsersRepository {
   constructor(private routerRepository: RouterRepository) {
     routerRepository.selectNavigationCancel().subscribe();
   }
}

selectNavigationError

import { RouterRepository } from '@ngneat/elf-ng-router-store';

export class UsersRepository {
   constructor(private routerRepository: RouterRepository) {
     routerRepository.selectNavigationError().subscribe();
   }
}

Use case

For example, we can create a query that maps an id from the URL to an entity in the store:

export class ArticlesRepository {
  selectArticle$ = this.routerRepository.selectParams('id').pipe(
     switchMap(id => this.selectEntity(id))
  );

  constructor(private routerRepository: RouterRepository) {}
}

And use it in the component:

@Component()
export class ArticleComponent {
  article$ = this.articlesRepository.selectArticle$;

  constructor(private articlesRepository: ArticlesRepository) {}
}

Lazy Load Modules

To get the lazy modules routing params, add the following option to the RouterModule.forRoot method:

{
  imports: [
    RouterModule.forRoot(routes, {
      paramsInheritanceStrategy: 'always'
    })
  ]
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].