ama icon indicating copy to clipboard operation
ama copied to clipboard

How to set the State Interface with http request

Open m4rkss opened this issue 7 years ago • 0 comments

Hi,

I try to make some changes using this post:https://toddmotto.com/component-architecture-reactive-forms-angular But I try to initialize the State interface with HttpRequest values: How can I get this values from request?

I try in Pizza.service.ts:

 state: State = {
         sections: this.getSecciones_Get()
    };
  private subject = new BehaviorSubject<State>(this.state);
    store = this.subject.asObservable().distinctUntilChanged();

      select<T>(name: string): Observable<T []> {   
        return this.store.pluck(name);
    }

My interface AppMain.ts:

export interface AppMain{
    name: string,
    sections: ISections []

}
export type Sections= ISections;

export interface ISections{

      SectionName:string;
     NumberSection:number;
}

Please can you help to adapt this solution initialize alues from http request?

Many thanks.

m4rkss avatar Nov 07 '17 11:11 m4rkss