Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@hackages/ngx-routing-history
Advanced tools
Why use ngx-routing-history, how to install and use.
A provider for routing history.
Check out the documentation below.
yarn add @hackages/ngx-routing-history
# OR
npm i @hackages/ngx-routing-history
Just add ngx-routing-history to your module & setup the RouterModule like this for example:
const APP_ROUTES: Route[] = [
{
path: 'home',
component: HomeComponent
},
{
path: 'detail',
component: DetailComponent
},
{path: '**', redirectTo: 'home'}
];
@NgModule({
imports: [RouterModule.forRoot(APP_ROUTES)],
exports: [RouterModule]
})
export class AppRoutingModule {}
import { NgxRoutingHistoryModule } from '@hackages/ngx-routing-history';
@NgModule({
imports: [
AppRoutingModule,
NgxRoutingHistoryModule
]
})
ngx-routing-history provides you 7 functions which will help you manage your history
This function need to be used in your root component. It will begin the record of your navigation in your website
export class AppComponent {
constructor(routingHistory: NgxRoutingHistoryProvider) {
routingHistory.loadRouting();
}
}
getHistory will give you an array with all your routing history
with getUrlByIndex you need pass in argument the index of the route you want get in the history stack
getUrlByIndex(index);
with getCurrentUrl you get the current route url
with getPreviousUrl you get the previous route url
this function will just pass the url in parameter to the router navigate function
the back function take an object with two possible key the first is an url you can give and if you have it in your stack that will clean every route in the stack after the route pass. If you pass nothing that you just take the previousUrl.
The second key in the object is defaultRoute, you can use this one if you want a backup route if there is no route in the history stack
export class DetailComponent implements OnInit {
public previousRoute: string;
constructor(private routingHistory: NgxRoutingHistoryProvider) {}
ngOnInit() {
this.previousRoute = this.routingHistory.getPreviousUrl();
}
back() {
this.routingHistory.back({url: this.previousRoute, defaultRoute: '/home'});
}
}
Please see the contributing guidelines.
FAQs
A provider for routing history
The npm package @hackages/ngx-routing-history receives a total of 4 weekly downloads. As such, @hackages/ngx-routing-history popularity was classified as not popular.
We found that @hackages/ngx-routing-history demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.