Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.