In my Angular 7 app, I have an entity defined in my typescript file as follows:
export class FeedbackType {
id: number;
name: String;
}
I am looking to create a function within this entity that checks the value of a property. For example:
feedbackType.IsGreat();
After some research, I attempted the following:
export class FeedbackType {
id: number;
name: String;
public isGreat() {
return this.name === 'Great';
}
}
However, I encountered the following error:
feedbackType.isGreat is not a function
This concept is akin to the method seen in C#:
public static bool IsGreat(this FeedbackType feedbackType)
{
return feedbackType.name == "Great";
}