Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

1
Angular - Property 'value' does not exist on type 'EventTarget' but called function takes value as the param
Post Flair (click to view more posts with a particular flair)
Post Body

I'm currently taking a udemy course to learn Angular but I'm not sure why I'm getting this error.The onChangeLength function in the component.ts file should be grabbing the value from the component.html file and the name is still "value. I was assuming that it would still be able to grab it from the event.target.value.

I did try setting it as onChangeLength($any($event).target.value but that just ends up returning undefined for the password value at the end.When I check my code against the course code, it is nearly identical. However, theirs is running with ES 2018 while I'm on ES 2022. I'm guessing that could be part of it.

I've tried messing with the any property but it ends up returning undefined when the password generates. I've tried posting in both regular and markdown mode but the code block ends up being all over the place no matter what.

Errors" Object is possibly null" "Property of value does not exist on type EventTarget"

app.component.html

<div>
<label>Enter Length</label>
<input (input)="onChangeLength($event.target.value)" />
</div>

app.component.ts

export class AppComponent { length = 0; includeLetters = false; includeNumbers = false; includeSpecialCharacters = false; password = '';

onChangeLength(value: string) { const parsedValue = parseInt(value);

if (!isNaN(parsedValue)) {
  this.length = parsedValue;
}

}

Author
Account Strength
100%
Account Age
5 years
Verified Email
Yes
Verified Flair
No
Total Karma
9,114
Link Karma
553
Comment Karma
8,165
Profile updated: 2 days ago
Posts updated: 1 month ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
8 months ago