Skip to content
This repository was archived by the owner on Jan 11, 2019. It is now read-only.

Completing refactor to Directives with scope property re #1 #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion product-panels.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ <h4> Reviews </h4>
<product-review ng-repeat="review in product.reviews"
review="review"></product-review>

<product-review-form></product-review-form>
<product-review-form reviews="product.reviews"></product-review-form>
</div>
</aside>
12 changes: 6 additions & 6 deletions product-review-form.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<form class="form-horizontal"
ng-submit="reviews.addReview(product.reviews)">
ng-submit="reviewer.addReview(reviews)">
<product-review class="well live-preview"
ng-show="!reviews.review.isEmpty()"
review="reviews.review">
ng-show="!reviewer.review.isEmpty()"
review="reviewer.review">
</product-review>

<fieldset class="form-group">
<label>Your Review:</label>
<textarea class="form-control" rows="5"
ng-model="reviews.review.body"></textarea>
ng-model="reviewer.review.body"></textarea>
</fieldset>
<fieldset class="form-group">
<label>Stars:</label>
<select ng-model="reviews.review.stars">
<select ng-model="reviewer.review.stars">
<option value="5">5 stars</option>
<option value="4">4 stars</option>
<option value="3">3 stars</option>
Expand All @@ -23,7 +23,7 @@
<fieldset class="form-group">
<label>by:</label>
<input type="email" placeholder="[email protected]"
ng-model="reviews.review.author">
ng-model="reviewer.review.author">
</fieldset>
<button type="submit" class="btn btn-primary pull-right">Submit</button>
</form>
Expand Down
5 changes: 4 additions & 1 deletion scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,11 @@
this.review = new Review;
}
},
controllerAs: 'reviews',
controllerAs: 'reviewer',
templateUrl: 'product-review-form.html',
scope: {
reviews: '='
}
};
})
; // END module(store)
Expand Down