diff --git a/app/index.js b/app/index.js index 4d88fd3b0..57045e4b5 100644 --- a/app/index.js +++ b/app/index.js @@ -175,6 +175,7 @@ Generator.prototype.askForModules = function askForModules() { } if (this.routeModule) { angMods.push("'ngRoute'"); + this.env.options.ngRoute = true; } if (angMods.length) { @@ -186,6 +187,7 @@ Generator.prototype.askForModules = function askForModules() { }; Generator.prototype.readIndex = function readIndex() { + this.ngRoute = this.env.options.ngRoute; this.indexFile = this.engine(this.read('../../templates/common/index.html'), this); }; @@ -277,6 +279,7 @@ Generator.prototype.appJs = function appJs() { }; Generator.prototype.createIndexHtml = function createIndexHtml() { + this.indexFile = this.indexFile.replace(/'/g, "'"); this.write(path.join(this.appPath, 'index.html'), this.indexFile); }; diff --git a/main/index.js b/main/index.js index f1c8abf00..000bcd62c 100644 --- a/main/index.js +++ b/main/index.js @@ -13,5 +13,6 @@ util.inherits(Generator, ScriptBase); Generator.prototype.createAppFile = function createAppFile() { this.angularModules = this.env.options.angularDeps; + this.ngRoute = this.env.options.ngRoute; this.appTemplate('app', 'scripts/app'); }; diff --git a/templates/coffeescript-min/app.coffee b/templates/coffeescript-min/app.coffee index 3f7bb2792..4d1b15d79 100644 --- a/templates/coffeescript-min/app.coffee +++ b/templates/coffeescript-min/app.coffee @@ -1,6 +1,6 @@ 'use strict' -angular.module('<%= scriptAppName %>', [<%= angularModules %>]) +angular.module('<%= scriptAppName %>', [<%= angularModules %>])<% if (ngRoute) { %> .config ['$routeProvider', ($routeProvider) -> $routeProvider .when '/', @@ -9,3 +9,4 @@ angular.module('<%= scriptAppName %>', [<%= angularModules %>]) .otherwise redirectTo: '/' ] +<% } %> \ No newline at end of file diff --git a/templates/coffeescript/app.coffee b/templates/coffeescript/app.coffee index 7383e998d..3106b4d51 100644 --- a/templates/coffeescript/app.coffee +++ b/templates/coffeescript/app.coffee @@ -1,6 +1,6 @@ 'use strict' -angular.module('<%= scriptAppName %>', [<%= angularModules %>]) +angular.module('<%= scriptAppName %>', [<%= angularModules %>])<% if (ngRoute) { %> .config ($routeProvider) -> $routeProvider .when '/', @@ -8,3 +8,4 @@ angular.module('<%= scriptAppName %>', [<%= angularModules %>]) controller: 'MainCtrl' .otherwise redirectTo: '/' +<% } %> \ No newline at end of file diff --git a/templates/common/index.html b/templates/common/index.html index 429e15591..39fd44cef 100644 --- a/templates/common/index.html +++ b/templates/common/index.html @@ -22,7 +22,11 @@ -
+ <% if (ngRoute) { + %>
<% + } else { + %>
<% + } %>