Skip to content

Instantly share code, notes, and snippets.

@jplemieux66
Created May 29, 2018 12:24
Show Gist options
  • Save jplemieux66/20a1b1102578417a4a20e60a1cc0633e to your computer and use it in GitHub Desktop.
Save jplemieux66/20a1b1102578417a4a20e60a1cc0633e to your computer and use it in GitHub Desktop.
import { Component } from '@angular/core';
import { Store } from '@ngrx/store';
import { Observable } from 'rxjs/Observable';
import { ChangeSelectedWeek } from '../../actions/dates';
import { WeekInfo } from '../../models/week-info.model';
import * as fromProjects from '../../reducers';
@Component({
selector: 'projects-panel',
templateUrl: './projects-panel.component.html',
styleUrls: ['./projects-panel.component.css']
})
export class ProjectsPanelComponent {
selectedWeekInfo$: Observable<WeekInfo>
constructor(private store: Store<fromProjects.State>) {
this.selectedWeekInfo$ = this.store.select(fromProjects.getSelectedWeekInfo)
}
weekSelectedChanged(selectedWeekInfo: WeekInfo) {
this.store.dispatch(new ChangeSelectedWeek(selectedWeekInfo));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment