How to make the index from ngFor part of an html tag value

I have an ngFor loop set up like this: <div *ngFor="let record of this.RecordsProcessed; let i = index"> <div class="row my-16" data-test=’test’_{{i}}> <div class="col-4">Id:</div> <div class="col-8">{{record?.Id}}</div> </div> </div> I want to put the index from ngFor on the data-text tag within the html. Is it possible to do something like this within the html? >Solution… Read More How to make the index from ngFor part of an html tag value

Default content for ng-content when using ngIf

I have this Angular 9 component, named inner: <div #ref> <ng-content select="[content]"></ng-content> </div> <ng-container *ngIf="!ref.hasChildNodes()"> <div>Default value</div> </ng-container> It will be displayed "Some content" if I use it in a parent component this way: <inner><div content>Some content</div><inner> It will be displayed "Default value" if I use it in a parent component this way: <inner><inner> But… Read More Default content for ng-content when using ngIf

angular dupicate url when routing

duplicate UR: ERROR Error: Uncaught (in promise): Error: NG04002: Cannot match any routes. URL Segment: ‘user/catalog/user/guide’ created user routing module: const routes: Routes = [ { path: ‘user/catalog’, component:TestCatalogComponent }, { path:’user/guide’, component:TestGuideComponent } ] @NgModule({ imports: [ RouterModule.forChild(routes) ], exports:[RouterModule] }) export class UserRoutingModule { } app routing const routes: Routes = []; @NgModule({… Read More angular dupicate url when routing

How to switch off top-item selection for mat-nav-list inside mat-sidenav?

I’m using a fairly straightforward navigation list inside mat-sidenav, and whenever the sidenav is shown, it always highlights the top menu item: <mat-sidenav-container class="example-container"> <mat-sidenav #sidenav mode="over"> <mat-nav-list> <mat-list-item *ngFor="let i of menuItems" [routerLink]="i.link"> <span matListItemTitle>{{i.title}}</span> </mat-list-item> </mat-nav-list> </mat-sidenav> <mat-sidenav-content> side content </mat-sidenav-content> </mat-sidenav-container> I cannot fathom what causes it to highlight the top menu… Read More How to switch off top-item selection for mat-nav-list inside mat-sidenav?

how to concat all license number into one array using angular15 and javascript

i am using angular15 and have an autocomplete search based on input, but the response i get is having License number as array of strings in all the objects. now i need to collect all license number from objects and make it as one array of object or array of Strings. Expected output : LicenseInfo:… Read More how to concat all license number into one array using angular15 and javascript

Return model to angular, but do not show all fields in dynamic table

I have some ViewModels that I get from API, and those models should be shown in dynamic table in Angular.For example CountryTableViewModel: public class CountryTableViewModel : IMapFrom<Country> { public int ID { get; set; } public string CreatedBy {get;set;} public string Name { get; set; } public bool Active { get; set; } } After… Read More Return model to angular, but do not show all fields in dynamic table