Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@angular/router
Advanced tools
The @angular/router package provides navigation and URL manipulation capabilities for Angular applications. It allows developers to define routes, navigate between them, handle route parameters, and guard routes among other functionalities.
Route Configuration
Defines routes in an Angular application, associating paths with components.
const routes: Routes = [
{ path: 'home', component: HomeComponent },
{ path: 'about', component: AboutComponent }
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
Router Outlet
A placeholder that Angular dynamically fills based on the current router state.
<router-outlet></router-outlet>
Navigation
Programmatically navigate to different routes within an Angular application.
constructor(private router: Router) { }
navigateToHome() {
this.router.navigate(['/home']);
}
Route Parameters
Access parameters for a given route, often used for fetching data based on the URL.
constructor(private route: ActivatedRoute) { }
ngOnInit() {
this.route.paramMap.subscribe(params => {
this.userId = params.get('id');
});
}
Route Guards
Protect routes with guards that can allow or prevent navigation to a route based on logic such as authentication.
@Injectable({ providedIn: 'root' })
export class AuthGuard implements CanActivate {
canActivate(
next: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean {
return this.authService.isAuthenticated();
}
}
React Router is a routing library for React, similar to @angular/router but for React applications. It provides components for navigation, route matching, and history handling. While @angular/router is designed specifically for Angular, React Router is tailored to React's component structure.
Vue Router is the official router for Vue.js. It integrates deeply with Vue.js core to make building Single Page Applications with Vue.js a breeze. It offers features similar to @angular/router but is designed to work seamlessly with Vue.js components and reactivity system.
Reach Router is a small, simple router for React that is accessible and easy to use. It is similar to @angular/router in providing navigation and route matching, but it focuses on simplicity and accessibility. It has now been succeeded by React Router, which has incorporated its accessibility features.
The sources for this package are in the main Angular repo. Please file issues and pull requests against that repo.
Usage information and reference details can be found in Angular documentation.
License: MIT
17.0.6 (2023-12-06)
| Commit | Type | Description | | -- | -- | -- | | a2e5f483f5 | fix | generate proper code for nullish coalescing in styling host bindings (#53305) |
| Commit | Type | Description | | -- | -- | -- | | 66ecf4c274 | fix | add compiler option to disable control flow content projection diagnostic (#53387) | | 74e6ce5d23 | fix | add diagnostic for control flow that prevents content projection (#53387) | | 6ec7a42b95 | fix | avoid conflicts with built-in global variables in for loop blocks (#53319) |
| Commit | Type | Description |
| -- | -- | -- |
| 0a53f96094 | fix | cleanup signal consumers for all views (#53351) |
| 4fc1581bbc | fix | handle hydration of multiple nodes projected in a single slot (#53270) |
| 14e66533ec | fix | support hydration for cases when content is re-projected using ng-template (#53304) |
| 8e366e8911 | fix | support swapping hydrated views in @for
loops (#53274) |
| Commit | Type | Description | | -- | -- | -- | | 45064f1ae1 | fix | CF migration - ensure NgIfElse attributes are properly removed (#53298) | | a6275cfa54 | fix | CF Migration - Fix case of aliases on i18n ng-templates preventing removal (#53299) | | 58a96e0f50 | fix | CF Migration add support for ngIf with just a then (#53297) | | 26e40c7f89 | fix | CF Migration fix missing alias for bound ngifs (#53296) | | 836aeba01d | fix | Change CF Migration ng-template placeholder generation and handling (#53394) | | 72d22ba7ee | fix | fix regexp for else and then in cf migration (#53257) | | 7a2facae8a | fix | handle aliases on bound ngIf migrations (#53261) | | 5104a89b30 | fix | handle nested ng-template replacement safely in CF migration (#53368) | | 2a4e3f5373 | fix | handle templates outside of component in cf migration (#53368) | | 0db75ab5b1 | fix | remove setting that removes comments in CF migration (#53350) |
| Commit | Type | Description | | -- | -- | -- | | 13ade13a15 | fix | Ensure canMatch guards run on wildcard routes (#53239) |
<!-- CHANGELOG SPLIT MARKER --><a name="17.0.5"></a>
FAQs
Angular - the routing library
The npm package @angular/router receives a total of 2,330,016 weekly downloads. As such, @angular/router popularity was classified as popular.
We found that @angular/router demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.