File tree 4 files changed +25
-28
lines changed
4 files changed +25
-28
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ module.exports = {
2
2
files : [
3
3
'public/index.html' ,
4
4
'public/app.js' ,
5
+ 'public/template.js' ,
5
6
'public/stylesheets/styles.css'
6
7
] ,
7
8
proxy : {
Original file line number Diff line number Diff line change 1
- ( function ( ) {
2
- angular . module ( 'app' , [ 'ngRoute' ] )
3
- . config ( config ) ;
1
+ class AppConfig {
4
2
5
- config . $inject = [ '$routeProvider' , '$locationProvider' ] ;
6
-
7
- function config ( $routeProvider , $locationProvider ) {
3
+ constructor ( $routeProvider , $locationProvider ) {
8
4
9
5
// routing
10
6
$locationProvider . html5Mode ( true ) ;
21
17
template : `
22
18
<h1>MEAN Squad Library</h1>
23
19
<p>Welcome to <em>MEAN Squad Library</em>, a library web application built with the MEAN Stack.
24
- <records-counts><records-counts>
20
+ <records-counts></ records-counts>
25
21
`
26
22
} )
27
23
}
28
- } ) ( ) ;
24
+
25
+ }
26
+
27
+ angular . module ( 'app' , [ 'ngRoute' ] )
28
+ . config ( AppConfig ) ;
29
+
30
+
29
31
30
32
31
33
Original file line number Diff line number Diff line change @@ -3,5 +3,5 @@ <h1>Library Records</h1>
3
3
< p > The library has the following record counts:</ p >
4
4
5
5
< ul >
6
- < li > < strong > Books:</ strong > {{count}}</ li >
6
+ < li > < strong > Books:</ strong > {{$ctrl. count}}</ li >
7
7
</ ul >
Original file line number Diff line number Diff line change 1
- ( function ( ) {
2
-
3
- angular . module ( 'app' ) . directive ( 'recordsCounts' , Directive ) ;
4
-
5
- function Directive ( ) {
6
- return {
7
- restrict : 'E' ,
8
- controller : Controller ,
9
- templateUrl : '/records/records-counts.html' ,
10
- }
11
- }
12
-
13
- Controller . $inject = [ '$scope' ] ;
14
-
15
- function Controller ( $scope ) {
16
- $scope . count = 11 ;
17
- }
18
-
19
- } ) ( ) ;
1
+ class RecordsCountsController {
2
+ $onInit ( ) {
3
+ this . count = 28 ;
4
+ }
5
+ }
6
+
7
+ const RecordsCountsComponent = {
8
+ restrict : 'E' ,
9
+ controller : RecordsCountsController ,
10
+ templateUrl : '/records/records-counts.html'
11
+ } ;
12
+
13
+ angular . module ( 'app' ) . component ( 'recordsCounts' , RecordsCountsComponent ) ;
You can’t perform that action at this time.
0 commit comments