npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@rxweb/angular-router

v0.0.2

Published

[![Build Status](https://travis-ci.org/rxweb/rxweb.svg?branch=master)](https://travis-ci.org/rxweb/rxweb) [![Gitter](https://badges.gitter.im/rx-web/Lobby.svg)](https://gitter.im/rxweb-project/rxweb?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge

Downloads

201

Readme

Build Status Gitter Codacy Badge DeepScan grade GitHub license

npm install @rxweb/angular-router

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    RxRoutingModule,
    BrowserModule,
    AppRoutingModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Authentication

The authentication parameter will be provided a global AuthResolver class which will resolve the user object whenever the user will log in after that the user object will be available to the component whenever the route navigation takes place even if the page is refreshed, There is no need to store this in local storage which provides better security which is implemented using the following steps.

Step 1:

Constructing The Global Authentication resolver:

export class AuthResolver implements IAuthResolver {

  resolveAuth() {
    // Wite the custom logic here..
     ...
  }
}

Step 2:

Declaring it using @routerModule in the root module:

@routerModule({
    authentication: AuthResolver
  })
@NgModule({...})
export class AppModule { }

Authorization

The authorization class is used for performing role based authorization based upon the user logged-in the client application, The access is provided after the resolved object is obtained are categorized into three ways(Page level access, component level access, control level access)

Retrieving the user access object is done based upon the application module and the action type. This is resolved globally whenever the navigation takes place throughout the application using Authorize function.

Step 1 :

Constructing the global Authorization Resolver

export class AuthorizationResolver implements IAuthorize {

  authorize(authorizeConfig: AuthorizeConfig,
    route: ActivatedRouteSnapshot
  ): Promise<boolean> | boolean {
    // Wite the custom logic here..
    ....
  }
}

Step 2:

Declaring it using @routerModule in the root module:

@routerModule({
    authorization: AuthorizationResolver
  })
@NgModule({...})
export class AppModule { }

Step 3 :

Setting access on the component using @access:

@access({accessLevel:1,action:'get'})
export class CandidateComponent implements OnInit {
 ...
}

Step 4:

Setting up the route:

const ROUTES: Routes = [
    {
        path: '',
        component: CandidateComponent, canActivate: [BaseCanActivate] 
    }
];

Middleware

To invoke some task pre navigation globally whenever any request is made to perform data management and communication in a centralized manner.

Step 1:

Constructing the global middleware:

export class ConfigurationResolver implements IMiddleware {
  
  invoke(user: { [key: string]: any }) {
    // Wite the custom logic here..
   ...
  }
}

Step 2:

Declaring it using @routerModule in the root module:

@routerModule({
    middlewares:[ConfigurationResolver]
  })
@NgModule({...})
export class AppModule { }

*rxAuthorize Directive

Authorizing the shared component and the controls using the *rxAuthorize by passing the component name along with the directive, To restrict the control to the unauthorized users in the application using this diecrtive is done as below:

Step 1:

<a *rxAuthorize="candidateAvailabilityAdd" (click)="addCandidateAvailability " ><i class="fa fa-plus ml-2"></i></a>

@rxweb/angular-router provides mechanism to perform decorator based component specific authorization and invoking component level middleware using decorators @access, @anonymous and @middleware