added normalized models and builders

This commit is contained in:
Art Lowel
2017-04-20 14:21:21 +02:00
parent 8e0d2bac9b
commit c2da34b305
30 changed files with 642 additions and 160 deletions

View File

@@ -1,11 +1,4 @@
import { Component, ChangeDetectionStrategy, ViewEncapsulation, OnInit } from '@angular/core';
import { Observable } from "rxjs";
import { Collection } from "../core/shared/collection.model";
import { Item } from "../core/shared/item.model";
import { CollectionDataService } from "../core/data/collection-data.service";
import { ItemDataService } from "../core/data/item-data.service";
import { ObjectCacheService } from "../core/cache/object-cache.service";
import { RemoteData } from "../core/data/remote-data";
import { Component, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core';
@Component({
changeDetection: ChangeDetectionStrategy.Default,
@@ -14,16 +7,11 @@ import { RemoteData } from "../core/data/remote-data";
styleUrls: ['./home.component.css'],
templateUrl: './home.component.html'
})
export class HomeComponent implements OnInit {
data: any = {};
collections: RemoteData<Collection[]>;
items: RemoteData<Item[]>;
export class HomeComponent {
constructor(
private cds: CollectionDataService,
private ids: ItemDataService,
private objectCache: ObjectCacheService
) {
data: any = {};
constructor() {
this.universalInit();
}
@@ -31,13 +19,4 @@ export class HomeComponent implements OnInit {
}
ngOnInit(): void {
this.collections = this.cds.findAll();
this.items = this.ids.findAll();
this.cds.findById('5179').payload.subscribe(o => console.log('collection 1', o));
this.cds.findById('6547').payload.subscribe(o => console.log('collection 2', o));
this.ids.findById('8871').payload.subscribe(o => console.log('item 1', o));
this.ids.findById('9978').payload.subscribe(o => console.log('item 2', o));
}
}