Skip to content

Commit 607e713

Browse files
committed
feat(modules) Create modularized structure of ng-devstack
1 parent 4c2eb17 commit 607e713

11 files changed

Lines changed: 62 additions & 30 deletions

config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
"paths" : {
77
"scripts": [
8+
"src/+(app|common)/**/*.module.js",
89
"src/+(app|common)/**/*.js",
910
"!src/+(app|common)/**/*.spec.js"
1011
],

gulpfile.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ gulp.task('assets', ['assets:img', 'vendor:assets'], function () {
151151
var fnInject = function (path) {
152152
var inject = {
153153
css : (config.vendor_files.css).concat(config.build + '/assets/*.css'),
154-
js : (config.vendor_files.js).concat(config.build + '/+(app|common)/**/*.js')
154+
js : (config.vendor_files.js).concat(config.build + '/+(app|common)/**/*.module.js').concat(config.build + '/+(app|common)/**/*.js')
155155
};
156156

157157
return gulp.src(inject.css.concat(inject.js), { read: false })
@@ -189,6 +189,7 @@ gulp.task('html', ['html:replace'], function () {
189189
// ============
190190
var testFiles = [
191191
config.build + '/vendor/**/*.js',
192+
config.build + '/+(app|common)/**/*.module.js',
192193
config.build + '/+(app|common)/**/*.js',
193194
config.mocks,
194195
config.paths.tests
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
'use strict';
22

3-
angular.module('ngDevstack.about', [
4-
'ui.router'
5-
])
3+
angular.module('ngDevstack.about')
64

75
.config(function ($stateProvider) {
86
$stateProvider.state('about', {
@@ -19,5 +17,4 @@ angular.module('ngDevstack.about', [
1917
});
2018
})
2119

22-
.controller('AboutCtrl', function ($scope) {
23-
});
20+
;

src/app/about/about.controller.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict';
2+
3+
angular.module('ngDevstack.about')
4+
5+
.controller('AboutCtrl', function ($scope) {
6+
})
7+
8+
;

src/app/about/about.module.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
'use strict';
2+
3+
angular.module('ngDevstack.about', [
4+
'ui.router'
5+
]);

src/app/app.js renamed to src/app/app.config.js

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
'use strict';
22

3-
angular.module('ngDevstack', [
4-
'ngDevstack.templates',
5-
'ngDevstack.conf',
6-
'ngDevstack.home',
7-
'ngDevstack.about',
8-
'ui.bootstrap',
9-
'ui.router'
10-
])
3+
angular.module('ngDevstack')
114

125
.config(function ($urlRouterProvider) {
136

@@ -42,14 +35,4 @@ angular.module('ngDevstack', [
4235
});
4336
})
4437

45-
.controller('AppCtrl', function ($rootScope, $scope) {
46-
47-
// handling UI Bootstrap Collapse plugin
48-
$scope.isCollapsed = true;
49-
50-
$rootScope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState, fromParams) {
51-
if (angular.isDefined(toState.data.pageTitle)) {
52-
$scope.pageTitle = toState.data.pageTitle + ' | ng-devstack';
53-
}
54-
});
55-
});
38+
;

src/app/app.controller.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
'use strict';
2+
3+
angular.module('ngDevstack')
4+
5+
.controller('AppCtrl', function ($rootScope, $scope) {
6+
7+
// handling UI Bootstrap Collapse plugin
8+
$scope.isCollapsed = true;
9+
10+
$rootScope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState, fromParams) {
11+
if (angular.isDefined(toState.data.pageTitle)) {
12+
$scope.pageTitle = toState.data.pageTitle + ' | ng-devstack';
13+
}
14+
});
15+
})
16+
17+
;

src/app/app.module.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'use strict';
2+
3+
angular.module('ngDevstack', [
4+
'ngDevstack.templates',
5+
'ngDevstack.conf',
6+
'ngDevstack.home',
7+
'ngDevstack.about',
8+
'ui.bootstrap',
9+
'ui.router'
10+
]);
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
'use strict';
22

3-
angular.module('ngDevstack.home', [
4-
'ui.router'
5-
])
3+
angular.module('ngDevstack.home')
64

75
.config(function ($stateProvider) {
86
$stateProvider.state('home', {
@@ -19,5 +17,4 @@ angular.module('ngDevstack.home', [
1917
});
2018
})
2119

22-
.controller('HomeCtrl', function ($scope) {
23-
});
20+
;

src/app/home/home.controller.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict';
2+
3+
angular.module('ngDevstack.home')
4+
5+
.controller('HomeCtrl', function ($scope) {
6+
})
7+
8+
;

0 commit comments

Comments
 (0)