У меня есть вызов API, однако, похоже, у меня возникают проблемы с получением свойств объекта.
step.component.ts
ngOnInit(){
this.stepService.getSteps().subscribe(appconfig => {
console.log(appconfig); //this returns me an object
console.log(appconfig.isstepcontactdisabled); // this gives me undefined
}
}
step.service.ts
getSteps(): Observable<Step> {
return this.http.get<Step>(appConfig.apiBasePath + "appconfig").pipe(
catchError(this.handleError),
);
}
step.ts
export interface Step {
appconfig: Appconfig;
}
export interface Appconfig {
isstepcontactdisabled: boolean;
isstepdevicebranddisabled: boolean;
issteppaymentinfodisabled: boolean;
isstepservicetypedisabled: boolean;
}
Вот мои результаты (console.log в step.component.ts, я получаю неопределенный)
Я попытался получить свойство, используя appconfig.isstepcontactdisabled и appconfig ["isstepcontactdisabled"], но это все еще показываеткак неопределено.Может ли кто-нибудь просветить меня?Ценю вашу помощь!