angular - Issue in implementing the Ngrx Store service into my component -
after user tried issue regarding post: my stackoverflow old post trying implement ngrx store using ngrx store github me solve multiples input/output event.
just after constructor have error:
counter
not assignable parameter of type(state: appstate) => boolean
:
child.ts:
import { component, input, output, eventemitter } '@angular/core'; import { userservice3 } '../user3.service'; import { store } '@ngrx/store'; import { observable } 'rxjs/observable'; import { on, off, reset } '../counter'; interface appstate { counter: boolean; } @component({ selector: 'my-daydetail', templateurl: './my-daydetail.component.html', styleurls: ['./my-daydetail.component.css'] }) export class mydaydetailcomponent { counter: observable<boolean>; constructor(private store: store<appstate>) { this.counter = store.select('counter'); } //... } // counter.ts import { action } '@ngrx/store'; export const on = 'on'; export const off = 'off'; export const reset = 'reset'; export function counterreducer(state: boolean = true, action: action) { switch (action.type) { case on: return false; case off: return true; case reset: return 0; default: return state; }
}
Comments
Post a Comment