File tree Expand file tree Collapse file tree 6 files changed +22
-4
lines changed
Expand file tree Collapse file tree 6 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,23 @@ Generator.prototype.askForModules = function askForModules() {
124124 this . cookiesModule = hasMod ( 'cookiesModule' ) ;
125125 this . sanitizeModule = hasMod ( 'sanitizeModule' ) ;
126126
127+ var angMods = [ ] ;
128+
129+ if ( this . cookiesModule ) {
130+ angMods . push ( "'ngCookies'" ) ;
131+ }
132+
133+ if ( this . resourceModule ) {
134+ angMods . push ( "'ngResource'" ) ;
135+ }
136+ if ( this . sanitizeModule ) {
137+ angMods . push ( "'ngSanitize'" ) ;
138+ }
139+
140+ if ( angMods . length ) {
141+ this . env . options . angularDeps = "\n " + angMods . join ( ",\n " ) + "\n" ;
142+ }
143+
127144 cb ( ) ;
128145 } . bind ( this ) ) ;
129146} ;
Original file line number Diff line number Diff line change @@ -12,5 +12,6 @@ var Generator = module.exports = function Generator() {
1212util . inherits ( Generator , ScriptBase ) ;
1313
1414Generator . prototype . createAppFile = function createAppFile ( ) {
15+ this . angularModules = this . env . options . angularDeps ;
1516 this . appTemplate ( 'app' , 'scripts/app' ) ;
1617} ;
Original file line number Diff line number Diff line change 11' use strict'
22
3- angular .module (' <%= _.camelize(appname) %>App' , [])
3+ angular .module (' <%= _.camelize(appname) %>App' , [< %= angularModules % > ])
44 .config [' $routeProvider' , ($routeProvider ) ->
55 $routeProvider
66 .when ' /' ,
Original file line number Diff line number Diff line change 11' use strict'
22
3- angular .module (' <%= _.camelize(appname) %>App' , [])
3+ angular .module (' <%= _.camelize(appname) %>App' , [< %= angularModules % > ])
44 .config ($routeProvider) ->
55 $routeProvider
66 .when ' /' ,
Original file line number Diff line number Diff line change 11'use strict' ;
22
3- angular . module ( '<%= _.camelize(appname) %>App' , [ ] )
3+ angular . module ( '<%= _.camelize(appname) %>App' , [ < %= angularModules % > ])
44 .config(['$routeProvider', function ($routeProvider) {
55 $routeProvider
66 . when ( '/' , {
Original file line number Diff line number Diff line change 11'use strict' ;
22
3- angular . module ( '<%= _.camelize(appname) %>App' , [ ] )
3+ angular . module ( '<%= _.camelize(appname) %>App' , [ < %= angularModules % > ])
44 .config(function ($routeProvider) {
55 $routeProvider
66 . when ( '/' , {
You can’t perform that action at this time.
0 commit comments