I have a class with a function:
export class Order {
status: string;
public isNew(): boolean {
return status == 'NEW';
}
}
When I create a new Order I can call the function:
let order = new Order();
order.isNew();
But if retrieve an order from my backend and call the method, I get an error, order.isNew is not a function:
this.http.get('url')
.map(response => response.json() as Order)
.subscribe(order => order.isNew());
What am I doing wrong?