Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question on Local template variables #2

Open
sverma16 opened this issue Jan 26, 2017 · 4 comments
Open

Question on Local template variables #2

sverma16 opened this issue Jan 26, 2017 · 4 comments

Comments

@sverma16
Copy link

Thorton

Thanks for a very informative article. Can these variables be created dynamically? ie depending on the number of records can i create #firstname_0, #firstname_1 using a *ngFor index?

SV

@ThorstenHans
Copy link
Owner

which article do you mean?

sorry for the delay :D had to configure my github notifications, now I get instant feedback 👍

@ThorstenHans
Copy link
Owner

having *ngFor you got automatically associated the current item to the variable you define within the expression.

like

<div *ngFor="let item of items; let i = index">
   <span>Index: {{i}} title: {{item.title}}</span>
</div>

@sverma16
Copy link
Author

Sorry to miss the link. Here is the article
https://www.xplatform.rocks/2016/01/07/angular2-quicky-local-template-variables/

I understand that these variables cannot and should not be created dynamically.

@ThorstenHans
Copy link
Owner

Ah I see,

what's the use case? What do you want to achieve by storing those values as dedicated variables?

If you could describe the use case a bit more, I can give you a better advice.

😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants