In my typescript file I have a code like this:
searchByID(_byid: ByID) {
// new instance of the Order model
this.order = new Order();
this._httpService.post(this.apiBaseURL + this.api + '/SolicitudSugerido/ByIdMst', _byid)
.subscribe(
data => {
this.productsResultArray = data,
this.order.fechahora = this.productsResultArray.fechahora;
this.order.idsestatus = this.productsResultArray.idsestatus;
this.order.idestatu = this.productsResultArray.idestatu;
this.order.abc = this.productsResultArray.abc;
this.order.guardar = this.productsResultArray.guardar;
//console.log(this.productsResultArray);
}
)
}
I have other component where I do this:
import { SolicitudComponent } from "./../solicitud/solicitud.component";
Then I have this method in the same component:
showSolicitudFormWithData() {
this.sugerido = this._solicitud.order;
this.fecha = this._solicitud.order.fechahora;
console.log(this.sugerido);
}
So the problem is that this.fecha when I try to see the value at console it says undefined, but this.sugerido prints this:
Order {} abc: true, fechahora: "", guardar: false, idestatu: "1"
So what I want to know is how can I print in my html component those values, I have tried: {{fecha}}, but it does not print the value.
I want to have access to that object in my view and in my ts file. For example to get that response in another object then i can iterate its properties one by one. Like:
this.order = this._solicitud.order;
this.order.fechahora = this._solicitud.order.fechahora;
this.order.idsestatus = this._solicitud.order.idsestatus;
Later if i want to just access one property or use it as parameter for another api call.