Sourav Golui
Sourav Golui

Reputation: 633

how to assign an array to an Observable type interface in angular

The problem is I want to assign a value on a observable type interface. But I don't know how to do that.

export interface LocalConsultationCachingModel {
  cache: ConsultationModel[];
  httpPromise: Observable<ConsultationModel[]>;
}

I want to assign on httpPromise: Observable<ConsultationModel[]>; }

Upvotes: 0

Views: 166

Answers (1)

Martin Choraine
Martin Choraine

Reputation: 2431

To set value to an observable you can just use of operator from RxJS. It'll emit your value then emits a complete notification.

let localConsultation : LocalConsultationCachingModel = {
   cache: [...],
   httpPromise: of([...])
}

Upvotes: 1

Related Questions