Skip to content

Commit

Permalink
debug commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mtlynch committed Nov 23, 2017
1 parent a7f834b commit a4d0b92
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/app/_components/recipe-list/recipe-list.component.html
Expand Up @@ -15,6 +15,9 @@
<div class="container" *ngIf="keywordsRaw && keywordsRaw.length > 0">
<p>Found {{ recipes.length }} matching recipes</p>
</div>
<p>page is {{currentPage}}</p>
<button (click)="resetPage()">Reset page</button>
<button (click)="filterRecipes()">Filter recipes</button>
<div *ngIf="loaded">
<pagination [boundaryLinks]="true"
[totalItems]="recipes.length"
Expand All @@ -23,6 +26,7 @@
class="pagination-sm"
[maxSize]="maxPageButtons"
previousText="Previous"
(pageChanged)="pageChanged($event)"
nextText="Next"
firstText="First"
lastText="Last">
Expand Down
15 changes: 14 additions & 1 deletion src/app/_components/recipe-list/recipe-list.component.ts
Expand Up @@ -83,8 +83,15 @@ export class RecipeListComponent implements OnInit {
return this.currentCategory === category ? 'btn-primary' : 'btn-default';
}

private filterRecipes() {
resetPage() {
console.log('called resetPage');
this.currentPage = 1;
}

filterRecipes() {
console.log(`currentPage=${this.currentPage}`);
this.currentPage = 1;
console.log(`currentPage=${this.currentPage}`);
let recipes: any[] = [];
if (this.currentCategory != null) {
recipes = this.recipesRaw.filter(recipe => recipe.category === this.currentCategory);
Expand All @@ -94,6 +101,12 @@ export class RecipeListComponent implements OnInit {
recipes = this.searchPipe.transform(recipes, this.keywords);
recipes = this.arraySortPipe.transform(recipes, 'publishedTime');
this.recipes = recipes;
this.currentPage = 1;
}

pageChanged(e) {
console.log('page changed');
console.log(e);
}

matchingIngredients(ingredients) {
Expand Down

0 comments on commit a4d0b92

Please sign in to comment.