Recently, I made updates to my Angular 8 project by switching it to the newest version of Angular 9. In one of the template's div elements, I declared a variable and everything seemed to be functioning correctly without any errors. To avoid initializing this variable in the .ts file (which would make it global and impact all instances where it is used within div elements), I left it as is.
However, following the upgrade to Angular 9, error messages started appearing stating 'Cannot assign value "undefined" to template variable "limit". template variables are read-only'. I would greatly appreciate any guidance or solutions on how to resolve this issue. Thank you in advance :)
<p *ngIf="displayLimit; let limit">
<li *ngFor="let industry of company_industries; let i = index">
<simple-tag type="white" class="industry-tag" *ngIf="i < limit" title="{{industry}}">
</simple-tag>
</li>
<button *ngIf="lessFlag && limit > displayLimit " class="edu_img"
(click)="limit = limit - displayLimit " >
<button *ngIf="limit < info.company_industries?.length" class="edu_img"
(click)="limit = limit + displayLimit " (click)="lessFlag = true">
</p>
I have sections within the code similar to the example above that also utilize the "limit" variable.