Skip to content

Commit

Permalink
Adding support for category query param (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtlynch committed Dec 19, 2017
1 parent cd315be commit b19fb7f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/app/_components/recipe-list/recipe-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,16 @@ export class RecipeListComponent implements OnInit {

ngOnInit() {
this.activatedRoute.queryParams.subscribe((params: Params) => {
if (!params['q']) {
return;
if (params['q']) {
this.keywordsRaw = params['q'];
this.updateSearchParams(this.keywordsRaw);
}

if (params['category']) {
this.currentCategory = params['category'];
console.log(this.currentCategory);
this.filterRecipes();
}
this.keywordsRaw = params['q'];
this.updateSearchParams(this.keywordsRaw);
});
}

Expand Down

0 comments on commit b19fb7f

Please sign in to comment.