Created
October 25, 2021 15:32
-
-
Save eimkasp/46ae3cfeeb7305ec4e28addad485b8d3 to your computer and use it in GitHub Desktop.
Angular Router Link Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sugeneruojama nuoroda | |
// Failas: src/app/app-routing.module.ts | |
const routes: Routes = [ | |
{ path: '', component: ProductsListComponent}, | |
{ path: 'products/:id', component: ProductPageComponent}, // Kaip Perduoti informaciją į šį route :id parametras | |
]; | |
// Naudojame html template [routerLink] direktyva perduodant informacijos masyva. | |
// 1 parametras url pavadinimas, 2 parametras, produkto ID kintamasis | |
// https://angular.io/api/router/RouterLink | |
<a [routerLink]="['/products', product.id]" | |
class="btn btn-primary"> | |
View <i class="ms-1 fas fa-eye"></i> | |
</a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment