Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit 307ad57

Browse files
committed
Better error handling for view recipe component when recipe is null (Chap. 6)
When there is no recipe to show (recipe is null): - Don’t display the edit button. - Inform user (via a message). Also removing unused div id=“recipe-details”.
1 parent 49c1b65 commit 307ad57

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Chapter_06/lib/component/view_recipe_component.html

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
<div id="recipe-details">
1+
<div>
22
<h3>Recipe Details</h3>
3-
<a class="extra-space" href="#/recipe/{{ctrl.recipe.id}}/edit">
4-
<input type="button" value="Edit Recipe"></a>
5-
63
<div ng-if="ctrl.recipe != null">
4+
<a class="extra-space" href="#/recipe/{{ctrl.recipe.id}}/edit">
5+
<input type="button" value="Edit Recipe">
6+
</a>
7+
78
<div><strong>Name: </strong>{{ctrl.recipe.name}}</div>
89
<div><strong>Category: </strong>{{ctrl.recipe.category}}</div>
910
<div><strong>Rating: </strong>
@@ -22,4 +23,7 @@ <h3>Recipe Details</h3>
2223
{{ctrl.recipe.directions}}
2324
</div>
2425
</div>
26+
<div ng-if="ctrl.recipe == null">
27+
<p>Sorry, we could not find the details of the recipe you requested.</p>
28+
</div>
2529
</div>

0 commit comments

Comments
 (0)