I'm working on creating a variable in my component of a specific type, as shown below.
myrequest.model.ts
export class MyRequest {
public endValue: string;
public yearEnd: string;
}
When importing the above into my component, I do the following:
myReqObj: MyRequest;
However, when I try to assign a value like this:
this.myReqObj.endValue = '23'
I get an error saying that myReqObj is undefined. Am I approaching this correctly? What is the correct way to do this?