diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 6810e9e..736b80c 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -42,6 +42,7 @@ import {AngularFireStorageModule} from 'angularfire2/storage';
RouterModule.forRoot([
{path: 'about', component: AboutComponent},
{path: 'formulaManager', component: FormulaManagerComponent},
+ {path: 'store/:category', component: CategoriesComponent},
{path: 'store', component: CategoriesComponent},
{path: '**', component: HomeComponent}
]),
diff --git a/src/app/store/categories.component.html b/src/app/store/categories.component.html
index 21a549f..eae5698 100644
--- a/src/app/store/categories.component.html
+++ b/src/app/store/categories.component.html
@@ -2,8 +2,8 @@
-
-
+
+
{{c.name}}
diff --git a/src/app/store/categories.component.ts b/src/app/store/categories.component.ts
index f9e1604..0258731 100644
--- a/src/app/store/categories.component.ts
+++ b/src/app/store/categories.component.ts
@@ -2,21 +2,29 @@ import {Component} from '@angular/core';
import {AngularFirestore} from 'angularfire2/firestore';
import {AngularFireStorage} from 'angularfire2/storage';
import {map} from 'rxjs/operators';
+import {ActivatedRoute} from '../../../node_modules/@angular/router';
@Component({
selector: 'store',
templateUrl: 'categories.component.html'
})
export class CategoriesComponent {
+ category: string;
categories;
- constructor(private db: AngularFirestore, private storage: AngularFireStorage) {
+ constructor(private db: AngularFirestore, private storage: AngularFireStorage, private route: ActivatedRoute) {}
+
+ ngOnInit() {
+ this.route.params.subscribe(params => {
+ this.category = params['category'];
+ });
+
this.categories = this.db
.collection('categories')
.valueChanges()
.pipe(
map(rows =>
- rows.map((row: any) => {
+ rows.filter((row: any) => !this.category || row.parent == this.category).map((row: any) => {
row.image = this.storage.ref(`${row.name.toLowerCase()}.jpg`).getDownloadURL();
row.image.subscribe(() => (row.ready = true));
return row;