-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Answer:1 content projection solution #1379
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
base: main
Are you sure you want to change the base?
Conversation
| CardType = CardType; | ||
| export class CardComponent<T> { | ||
| readonly list = input<T[] | null>(null); | ||
| readonly itemTemplate = input<TemplateRef<any> | null>(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can do it this way or you can use contentChild to get the template from the parent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can other type your template with a directive instead of using any
| cardType = CardType.STUDENT; | ||
|
|
||
| ngOnInit(): void { | ||
| this.http.fetchStudents$.subscribe((s) => this.store.addAll(s)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can now use new angular API like rxRessource to fetch data and being declarative
| [name]="item.firstName" | ||
| [id]="item.id" | ||
| [type]="cardType" | ||
| (onDeleteItem)="deleteTeacher($event)"></app-list-item> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very good
You don't need to pass id, when you get the onDeleteItem, you can pass item.id to the function in the parent
|
very good PR |
Checklist for challenge submission