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

Why does the ngFor-TrackBy html extension create a "item.id" and not use a function call? #132

Open
Chewieez opened this issue Sep 12, 2021 · 1 comment

Comments

@Chewieez
Copy link

"body": ["*ngFor=\"let ${1:item} of ${2:list}; trackBy:${1:item}.id\"${0}"],

This code above is the line in question. I am using the Angular snippets to speed up ngFor TrackBy usage. I first saw the extension in my .html file but Angular showed an error that it didn't know the value of item in trackBy: item.id. After researching I saw it appears the trackBy should call a function and not be assigned to a property of item. Then I found the a-trackby extension in the .ts file to create a trackBy function. Should these 2 extensions (the html and ts) ones work together? Should the html extension create this markup instead
*ngFor="let item of list; trackBy: trackBy"?

@Chewieez Chewieez changed the title Why does the ngFor-TrackBy extension create a "item.id" and not use a function call? Why does the ngFor-TrackBy html extension create a "item.id" and not use a function call? Sep 12, 2021
@johnpapa
Copy link
Owner

good question, im not aware of how they can be. any ideas?

@johnpapa johnpapa reopened this Jul 15, 2024
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