Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 92e03c0

Browse files
Update validation and filter tutorial
1 parent 6ae4bb1 commit 92e03c0

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

‎angular-validation-filter/index.html

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"
99
integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ=="
1010
crossorigin="anonymous">
11+
<link rel="stylesheet" href="style.css">
1112
</head>
1213
<body>
1314

@@ -23,7 +24,7 @@ <h1>{{product.name}}</h1>
2324
<img ng-src="{{product.images[0].thumb}}">
2425
</div>
2526

26-
<h2>$ {{product.price}}</h2>
27+
<h2>{{product.price | currency}}</h2>
2728

2829
<button class="btn btn-primary" ng-show="product.inStock">Thêm vào giỏ</button>
2930

@@ -61,7 +62,7 @@ <h4>Đánh giá</h4>
6162

6263
<form class="form-horizontal" name="reviewForm"
6364
ng-controller="ReviewController as reviewCtrl"
64-
ng-submit="reviewCtrl.addReview(product)">
65+
ng-submit="reviewForm.$valid && reviewCtrl.addReview(product)"novalidate>
6566
<blockquote>
6667
<b>{{reviewCtrl.review.stars}} star(s)</b>
6768
{{reviewCtrl.review.body}}
@@ -71,19 +72,19 @@ <h4>Đánh giá</h4>
7172
<div class="form-group">
7273
<label class="col-sm-1 control-label">Email</label>
7374
<div class="col-sm-6">
74-
<input ng-model="reviewCtrl.review.author" type="email" class="form-control" placeholder="Email">
75+
<input ng-model="reviewCtrl.review.author" type="email" class="form-control ng-pristine ng-invalid" placeholder="Email"required>
7576
</div>
7677
</div>
7778
<div class="form-group">
7879
<label class="col-sm-1 control-label">Review</label>
7980
<div class="col-sm-6">
80-
<textarea ng-model="reviewCtrl.review.body" class="form-control" rows="3"></textarea>
81+
<textarea ng-model="reviewCtrl.review.body" class="form-control" rows="3"required></textarea>
8182
</div>
8283
</div>
8384
<div class="form-group">
8485
<label class="col-sm-1 control-label">Star</label>
8586
<div class="col-sm-6">
86-
<select ng-model="reviewCtrl.review.stars" class="form-control">
87+
<select ng-model="reviewCtrl.review.stars" class="form-control"required>
8788
<option value="1">1 star</option>
8889
<option value="2">2 stars</option>
8990
<option value="3">3 stars</option>

‎angular-validation-filter/style.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.ng-invalid.ng-dirty {
2+
border-color: #FA787E;
3+
}
4+
5+
.ng-valid.ng-dirty {
6+
border-color: #78FA89;
7+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /