Skip to content

Exercise 9 - Templates - Buying Socks#33

Closed
jonathanrasquin wants to merge 18 commits intoitenium-be:masterfrom
jonathanrasquin:feature/exercise9
Closed

Exercise 9 - Templates - Buying Socks#33
jonathanrasquin wants to merge 18 commits intoitenium-be:masterfrom
jonathanrasquin:feature/exercise9

Conversation

@jonathanrasquin
Copy link
Copy Markdown

No description provided.

@jonathanrasquin
Copy link
Copy Markdown
Author

excuses, master vergeten te resetten :) volgende PR in orde

showAlertMessage(message: string, type: string) {
this.alertMessage = message;
this.alertType = type;
this.showAlert = true;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minder fields, minder dingen om in sync te houden::

get showAlert(): boolean {
  return !!this.alertMessage;
}

<button type="button" class="buy-socks" (click)="buy()" *ngIf="sock.inventory > 0">
BUY NOW
</button>
<div *ngIf="showAlert" [ngClass]="alertType" class="alert">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of hier gewoon: *ngIf="!!alertMessage"


<button type="button" class="buy-socks" (click)="buy()">
<p *ngIf="sock.inventory === 0" class="badge">SOLD OUT</p>
<button type="button" class="buy-socks" (click)="buy()" *ngIf="sock.inventory > 0">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je hoeft niet altijd een functie te gebruiken:
(is waarschijnlijk ook (persoonlijke) smaak)

<button (click)="showModal = true">

@Laoujin Laoujin closed this Mar 15, 2026
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

Successfully merging this pull request may close these issues.

2 participants