Skip to content

Commit

Permalink
Add conditional references
Browse files Browse the repository at this point in the history
  • Loading branch information
Jed Mao committed Jan 9, 2014
1 parent 96ab8cb commit 9008eb8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 3 additions & 1 deletion app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,15 @@ Generator.prototype.askForModules = function askForModules() {

if (this.cookiesModule) {
angMods.push("'ngCookies'");
this.env.options.ngCookies = true;
}

if (this.resourceModule) {
angMods.push("'ngResource'");
this.env.options.ngResource = true;
}
if (this.sanitizeModule) {
angMods.push("'ngSanitize'");
this.env.options.ngSanitize = true;
}
if (this.routeModule) {
angMods.push("'ngRoute'");
Expand Down
3 changes: 3 additions & 0 deletions main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ util.inherits(Generator, ScriptBase);

Generator.prototype.createAppFile = function createAppFile() {
this.angularModules = this.env.options.angularDeps;
this.ngCookies = this.env.options.ngCookies;
this.ngResource = this.env.options.ngResource;
this.ngSanitize = this.env.options.ngSanitize;
this.ngRoute = this.env.options.ngRoute;
this.appTemplate('app', 'scripts/app');
};
10 changes: 5 additions & 5 deletions templates/typescript/app.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/// <reference path="../bower_components/dt-angular/angular.d.ts" />
<% if (ngRoute) { %>/// <reference path="../bower_components/dt-angular/angular-route.d.ts" /><% } %>
/// <reference path="../bower_components/dt-angular/angular-resource.d.ts" />
/// <reference path="../bower_components/dt-angular/angular-sanitize.d.ts" />
/// <reference path="../bower_components/dt-angular/angular-resource.d.ts" />
/// <reference path="../bower_components/dt-angular/angular.d.ts" /><% if (ngCookies) { %>
/// <reference path="../bower_components/dt-angular/angular-cookies.d.ts" /><% } %><% if (ngResource) { %>
/// <reference path="../bower_components/dt-angular/angular-resource.d.ts" /><% } %><% if (ngSanitize) { %>
/// <reference path="../bower_components/dt-angular/angular-sanitize.d.ts" /><% } %><% if (ngRoute) { %>
/// <reference path="../bower_components/dt-angular/angular-route.d.ts" /><% } %>

'use strict';

Expand Down

0 comments on commit 9008eb8

Please sign in to comment.