Slide 51
Slide 51 text
game.model.ts
@Injectable()
export class GameModel extends Model {
game$: Observable;
constructor(protected _store: Store,
@Inject(AsyncService) _services) {
super(_services || []);
this.game$ = this._store.select('game');
}
...
completeGame(time: number, text: string) {
const action = GameActions.completeGame(time, text);
this._store.dispatch(action);
this.performAsyncAction(action)
.subscribe(() => console.log('Done!'));
}
}