Skip to content

2muchcoffeecom/ng2-router-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation

Install it from npm:

npm install ng2-router-helper

Usage

Including

Including RouterHelper Service

import {RouterHelper} from "ng2-router-helper";

@Component({
  template: `{{ routerHelper.is('routerName') | async }}`
  providers:[RouterHelper]
})
export class TestComponent {
  constructor(
    private routerHelper: RouterHelper
  ) {}
    
  this.isPartOfRoute$ = this.routerHelper.is('routerName2')
  this.isPartOfRoute$.subscribe(res=>{
    console.log(res)
  })
}
  • is(routePath):Observable<boolean> - Checking if the is the last part of the current URL
  • includes(routePath):Observable<boolean> - Checking if the needed part of the URL matches the

See also

About

Angular 2 router helper. Allows to get current state name.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published