I have c# class test1
public class test1
{
public int testID{ get; set; }
public string testName{ get; set; }
public int testValue{ get; set; }
}
In Angular I have testService which has function getObject
getObject(param) {
return this.http.post(appSettings.BackEndUrl + '/getObject?testID='+param,'');
}
In Angular I also made same type class
export class test1Model{
testID: Number;
testName: String;
testValue: Number;
}
Now In some component I want to create variable
testObjVariable: test1Model;
And put that api data inside it. I'm trying to do it this way
ngOnInit() {
this.testObjVariable = this.testService.getObject(this.testID);
}
And I get error
Type 'Observable' is missing the following properties from type 'test1Model': testID, testName, testValue
Despite the fact that teoretically I'm transfering just exactly those type of data. What am I doing wrong ?