File tree 6 files changed +142
-1
lines changed
6 files changed +142
-1
lines changed Original file line number Diff line number Diff line change 1
- var app = angular . module ( 'store' , [ ] ) ;
1
+ 'use strict' ;
2
+ var app = angular . module ( 'store' , [ ] ) ;
3
+
4
+ app . directive ( 'productTitle' , function ( ) {
5
+
6
+ return {
7
+
8
+ restrict : 'E' ,
9
+ templateUrl : 'product-title.html'
10
+
11
+ } ;
12
+
13
+ } ) ;
14
+
15
+ app . controller ( 'StoreController' , [ '$scope' , function ( $scope ) {
16
+
17
+ var products = [
18
+ {
19
+
20
+ name : 'Mouse and Keyboard Wireless' ,
21
+ price : '150,00' ,
22
+ description : 'Nice product' ,
23
+ images : [ ] ,
24
+ reviews : [
25
+ {
26
+ stars : 5 ,
27
+ body : 'I love this product' ,
28
+ author : 'Cristiano ronaldo' ,
29
+ } ,
30
+ {
31
+ stars : 1 ,
32
+ body : 'This product sucks' ,
33
+ author : 'Lionel Messi' ,
34
+ }
35
+ ]
36
+ }
37
+ ] ;
38
+
39
+ $scope . products = products ;
40
+
41
+ } ] ) ;
Original file line number Diff line number Diff line change
1
+ < html ng-app ="store ">
2
+ < head >
3
+ < link rel ="stylesheet " type ="text/css " href ="css/bootstrap.min.css " />
4
+ < script src ="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js "> </ script >
5
+ < script src ="js/app.js "> </ script >
6
+ </ head >
7
+ < body ng-controller ="StoreController as store ">
8
+ < ul class ="list-group ">
9
+ < li class ="list-group-item " ng-repeat ="product in store.products | orderBy: '-price' ">
10
+
11
+ < div class ="panel " ng-show ="panel.isSelected(3) ">
12
+ < h4 > Reviews</ h4 >
13
+ < blockquote ng-repeat ="review in product.reviews ">
14
+
15
+ < b > Stars: {{ review.stars }}</ b >
16
+ {{ review.body }}
17
+ < cite > {{ review.author }}</ cite >
18
+ </ blockquote >
19
+ </ div >
20
+ </ li >
21
+ </ ul >
22
+ </ body >
23
+ </ html >
Original file line number Diff line number Diff line change
1
+ < html ng-app ="store ">
2
+ < head >
3
+ < link rel ="stylesheet " type ="text/css " href ="css/bootstrap.min.css " />
4
+ < script src ="//ajax.googleapis.com/ajax/libs/angularjs/1.2.19/angular.min.js "> </ script >
5
+ < script src ="js/app.js "> </ script >
6
+ </ head >
7
+ < body ng-controller ="StoreController ">
8
+ < form name ="reviewForm ">
9
+
10
+ < blockquote >
11
+
12
+ < b > Stars: {{ review.stars }}</ b >
13
+ {{ review.body }}
14
+ < cite > {{ review.author }}</ cite >
15
+ </ blockquote >
16
+
17
+ < select ng-model ="review.stars ">
18
+ < option value ="1 "> 1 Stars</ option >
19
+ < option value ="2 "> 2 Stars</ option >
20
+ < option value ="3 "> 3 Stars</ option >
21
+ < option value ="4 "> 4 Stars</ option >
22
+ < option value ="5 "> 5 Stars</ option >
23
+ </ select >
24
+
25
+ < textarea ng-model ="review.body "> </ textarea >
26
+
27
+ < label > By: </ label >
28
+ < input ng-model ="review.author " type ="text " />
29
+ < input type ="submit ">
30
+ </ form >
31
+
32
+ </ body >
33
+ </ html >
Original file line number Diff line number Diff line change
1
+ < html ng-app ="store ">
2
+ < head >
3
+ < link rel ="stylesheet " type ="text/css " href ="css/bootstrap.min.css " />
4
+ < script src ="//ajax.googleapis.com/ajax/libs/angularjs/1.2.19/angular.min.js "> </ script >
5
+ < script src ="js/app.js "> </ script >
6
+ </ head >
7
+ < body ng-controller ="StoreController ">
8
+ < ul class ="list-group ">
9
+ < li class ="list-group-item " ng-repeat ="product in products | orderBy: '-price' ">
10
+
11
+ < div class ="panel ">
12
+ < h4 > Reviews</ h4 >
13
+ < blockquote ng-repeat ="review in product.reviews ">
14
+
15
+ < b > Stars: {{ review.stars }}</ b >
16
+ {{ review.body }}
17
+ < cite > {{ review.author }}</ cite >
18
+ </ blockquote >
19
+ </ div >
20
+
21
+ </ li >
22
+ </ ul >
23
+ </ body >
24
+ </ html >
Original file line number Diff line number Diff line change
1
+ < html ng-app ="store ">
2
+ < head >
3
+ < link rel ="stylesheet " type ="text/css " href ="css/bootstrap.min.css " />
4
+ < script src ="//ajax.googleapis.com/ajax/libs/angularjs/1.2.19/angular.min.js "> </ script >
5
+ < script src ="js/app.js "> </ script >
6
+ </ head >
7
+ < body ng-controller ="StoreController ">
8
+ < ul class ="list-group ">
9
+ < li class ="list-group-item " ng-repeat ="product in store.products | orderBy: '-price' ">
10
+ < product-title > </ product-title >
11
+ </ li >
12
+ </ ul >
13
+ </ body >
14
+ </ html >
Original file line number Diff line number Diff line change
1
+ < h3 >
2
+
3
+ {{ product.name }}
4
+
5
+ < em class ="pull-right "> ${{ product.price }} </ em >
6
+
7
+ </ h3 >
You can’t perform that action at this time.
0 commit comments