55693: Working store interaction for selecting items

This commit is contained in:
Kristof De Langhe
2018-09-27 11:09:36 +02:00
parent 5040d230fb
commit 09a84edb09
7 changed files with 45 additions and 12 deletions

View File

@@ -1,4 +1,4 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
import { ItemDataService } from '../../core/data/item-data.service';
import { PaginatedList } from '../../core/data/paginated-list';
import { RemoteData } from '../../core/data/remote-data';
@@ -21,13 +21,16 @@ export class ItemSelectComponent implements OnInit {
@Input()
paginationOptions: PaginationComponentOptions;
checked: boolean[] = [];
@Output()
confirm: EventEmitter<string[]> = new EventEmitter<string[]>();
selectedIds$: Observable<string[]>;
constructor(private itemSelectService: ItemSelectService) {
}
ngOnInit(): void {
this.itemsRD$.subscribe((value) => console.log(value));
this.selectedIds$ = this.itemSelectService.getAllSelected();
}
switch(id: string) {
@@ -38,4 +41,10 @@ export class ItemSelectComponent implements OnInit {
return this.itemSelectService.getSelected(id);
}
confirmSelected() {
this.selectedIds$.subscribe((ids: string[]) => {
this.confirm.emit(ids);
});
}
}