
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
@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
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.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.