Skip to content

Instantly share code, notes, and snippets.

@YonathanMeguira
Last active September 5, 2018 09:28
Show Gist options
  • Save YonathanMeguira/105d0a85395426ed22fd1cdecddf8ec8 to your computer and use it in GitHub Desktop.
Save YonathanMeguira/105d0a85395426ed22fd1cdecddf8ec8 to your computer and use it in GitHub Desktop.
shopping list
import { ListQuery, List } from '../state';
import { ShopikaService } from '../state/shopika.service';
import { ID } from '@datorama/akita';
import { Observable } from 'rxjs';
export class ListsComponent implements OnInit {
lists$: Observable<List[]>;
constructor(
private listQuery: ListQuery,
private shopikaService: ShopikaService
) { }
ngOnInit() {
this.lists$ = this.listQuery.selectAll();
}
select(id: ID) {
this.shopikaService.setActive(id);
}
delete(id: ID) {
this.shopikaService.deleteList(id);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment