Skip to content

Instantly share code, notes, and snippets.

@YonathanMeguira
Last active July 26, 2018 14:14
Show Gist options
  • Save YonathanMeguira/8b0cfc47f6fb69c922da5c0dafc37965 to your computer and use it in GitHub Desktop.
Save YonathanMeguira/8b0cfc47f6fb69c922da5c0dafc37965 to your computer and use it in GitHub Desktop.
shoppingComponent.ts
import { Component, OnInit, ChangeDetectionStrategy, Output, EventEmitter } from '@angular/core';
import { ListQuery, ListState, List } from '../state';
import { Observable } from 'rxjs';
import { ShopikaService } from '../state/shopika.service';
import { ID } from '@datorama/akita';
@Component({
selector: 'app-list',
templateUrl: './list.component.html',
styleUrls: ['./list.component.css'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ListComponent implements OnInit {
list$: Observable<List[]>;
newListRequest: boolean;
@Output() select = new EventEmitter<ID>();
constructor(private query: ListQuery, private service: ShopikaService) { }
ngOnInit() {
this.list$ = this.query.selectAll();
}
selectList(id: ID) {
this.select.emit(id);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment