diff --git a/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/list/_entityFile_.component.html.ejs b/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/list/_entityFile_.component.html.ejs index 18319f8e954e..6116e28cd709 100644 --- a/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/list/_entityFile_.component.html.ejs +++ b/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/list/_entityFile_.component.html.ejs @@ -64,7 +64,7 @@ <<%= jhiPrefixDashed %>-filter [filters]="filters">-filter> <%_ } _%> -@if ((<%= entityInstancePlural %>?.length ?? 0) === 0) { +@if (<%= entityInstancePlural %>().length === 0) {
__jhiTranslateTag__('<%- i18nKeyPrefix %>.home.notFound')
@@ -101,7 +101,7 @@ infinite-scroll (scrolled)="loadNextPage()" [infiniteScrollDisabled]="!hasMorePage()" [infiniteScrollDistance]="0"<% } %>> - @for (<%= entityInstance %> of <%= entityInstancePlural %>; track track<%= primaryKey.nameCapitalized %>(<%= entityInstance %>)) { + @for (<%= entityInstance %> of <%= entityInstancePlural %>(); track track<%= primaryKey.nameCapitalized %>(<%= entityInstance %>)) { <%_ const routerLink = ` [routerLink]="['/${ entityPage }', ${entityInstance}.${primaryKey.name}, 'view']"`; @@ -218,7 +218,7 @@ _%> } <%_ if (paginationPagination) { _%> -@if (<%= entityInstancePlural %> && <%= entityInstancePlural %>.length > 0) { +@if (<%= entityInstancePlural %>().length > 0) {
<<%= jhiPrefixDashed %>-item-count [params]="{ page: page, totalItems: totalItems, itemsPerPage: itemsPerPage }">-item-count> diff --git a/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/list/_entityFile_.component.spec.ts.ejs b/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/list/_entityFile_.component.spec.ts.ejs index 993881549954..039b1c56e3eb 100644 --- a/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/list/_entityFile_.component.spec.ts.ejs +++ b/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/list/_entityFile_.component.spec.ts.ejs @@ -131,7 +131,7 @@ describe('<%= entityAngularName %> Management Component', () => { // THEN expect(service.query).toHaveBeenCalled(); - expect(comp.<%= entityInstancePlural %><%= entityArrayOptionalChainSymbol %>[0]).toEqual(expect.objectContaining(<%- testEntityPrimaryKey %>)); + expect(comp.<%= entityInstancePlural %>()<%= entityArrayOptionalChainSymbol %>[0]).toEqual(expect.objectContaining(<%- testEntityPrimaryKey %>)); }); describe('track<%= primaryKey.nameCapitalized %>', () => { diff --git a/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/list/_entityFile_.component.ts.ejs b/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/list/_entityFile_.component.ts.ejs index c0fe58bb4cc7..cc8defc9b37b 100644 --- a/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/list/_entityFile_.component.ts.ejs +++ b/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/list/_entityFile_.component.ts.ejs @@ -122,7 +122,7 @@ export class <%= componentName %> implements OnInit { <%_ } _%> subscription: Subscription | null = null; - <%= entityInstancePlural %>?: I<%= entityAngularName %>[]; + <%= entityInstancePlural %> = signal[]>([]); isLoading = false; sortState = sortStateSignal({}); @@ -173,7 +173,7 @@ export class <%= componentName %> implements OnInit { tap(() => this.load()), <%_ } else { _%> tap(() => { - if (!this.<%= entityInstancePlural %> || this.<%= entityInstancePlural %>.length === 0) { + if (this.<%= entityInstancePlural %>().length === 0) { this.load(); } }), @@ -187,7 +187,7 @@ export class <%= componentName %> implements OnInit { <%_ if (paginationInfiniteScroll) { _%> reset(): void { - this.<%= entityInstancePlural %> = []; + this.<%= entityInstancePlural %>.set([]); } loadNextPage(): void { @@ -289,9 +289,9 @@ export class <%= componentName %> implements OnInit { <%_ } _%> const dataFromBody = this.fillComponentAttributesFromResponseBody(response.body); <%_ if (paginationNo) { _%> - this.<%= entityInstancePlural %> = this.refineData(dataFromBody); + this.<%= entityInstancePlural %>.set(this.refineData(dataFromBody)); <%_ } else { _%> - this.<%= entityInstancePlural %> = dataFromBody; + this.<%= entityInstancePlural %>.set(dataFromBody); <%_ } _%> } @@ -306,7 +306,7 @@ export class <%= componentName %> implements OnInit { <%_ if (paginationInfiniteScroll) { _%> // If there is previous link, data is a infinite scroll pagination content. if (this.links().prev) { - const <%= entityInstancePlural %>New = this.<%= entityInstancePlural %> ?? []; + const <%= entityInstancePlural %>New = this.<%= entityInstancePlural %>(); if (data) { for (const d of data) { <%_ if (primaryKey) { _%>