Skip to content

Exercise buying socks #35

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

davitenium
Copy link

No description provided.

<br>
Color: {{ sock.variant | titlecase }}

<br>
<br>

<button type="button" class="buy-socks" (click)="buy()">
<button id="buyBtn" *ngIf="sock.inventory > 0" type="button" class="buy-socks" (click)="buy()">
Copy link
Member

Choose a reason for hiding this comment

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

Avoid <HTMLInputElement> document.getElementById("buyBtn"); --> it's mixing together pure JavaScript & Angular.

In this case you could use:

 <button [disabled]="buttonDisabled" *ngIf="sock.inventory > 0" type="button" class="buy-socks" (click)="buy()">

If you really need to manipulate a DOM object manually (this should be rare)

constructor(elementRef: ElementRef) {}

See: https://angular.dev/guide/components/dom-apis#

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