Skip to content

Added possibility to add/remove ingredients to/from recipe#11

Open
sidlauskaslukas wants to merge 1 commit intomasterfrom
feature/add-ingredient-to-recipe
Open

Added possibility to add/remove ingredients to/from recipe#11
sidlauskaslukas wants to merge 1 commit intomasterfrom
feature/add-ingredient-to-recipe

Conversation

@sidlauskaslukas
Copy link
Copy Markdown
Owner

No description provided.

@sidlauskaslukas sidlauskaslukas requested a review from Edmu August 31, 2017 08:26
this.nav.pop();
}

addIngredient() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe openAddIngredient or navAddIngredient would suit better.

addIngredient() {
let addIngredientModal = this.modalCtrl.create(AddIngredientPage, {recipeTitle: this.recipe.name});
addIngredientModal.onDidDismiss(ingredient => {
if(ingredient) this.recipe.ingredients.push({id: ingredient.id, amount: 40});
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving onDidDismiss handler logic to class method and calling it from arrow function would be cleaner. Also hardcoded amount (40) could be changed to class attribute defaultNewIngredientAmount or something like that.

Copy link
Copy Markdown
Collaborator

@Edmu Edmu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants