For instance, envision a scenario where I have a series of input fields and I wish to assign the 'tab' attribute to them sequentially as we move down the page. Rather than hard-coding the tab numbers, I prefer to utilize a method that automatically increments the tab value. This way, if I decide to add a new input field later on, I won't have to manually adjust each tab number.
<input [attr.tab]="1" />
<input [attr.tab]="2" />
<input [attr.tab]="3" />
Is there a way to achieve this functionality within the confines of a component's template without encountering errors? I know that localized variables can be used in directives like *ngFor, but is it possible to implement something similar in a component template or any other context?
Could it be done using:
<input [attr.tab]="let i = 1, i" />
<input [attr.tab]="i++" />
<input [attr.tab]="i++" />
Template Syntax Documentation: https://angular.io/docs/ts/latest/guide/template-syntax.html
Edit: I am not interested in employing *ngFor or any sort of template loop for this purpose, as I am not aiming to define an inner template.