From 9008eb82379779a9263043338a4ce0bdb7a59a06 Mon Sep 17 00:00:00 2001 From: Jed Mao Date: Thu, 9 Jan 2014 10:11:05 -0600 Subject: [PATCH] Add conditional references --- app/index.js | 4 +++- main/index.js | 3 +++ templates/typescript/app.ts | 10 +++++----- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/index.js b/app/index.js index a27132b9c..2f274a3b9 100644 --- a/app/index.js +++ b/app/index.js @@ -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'"); diff --git a/main/index.js b/main/index.js index 000bcd62c..022308617 100644 --- a/main/index.js +++ b/main/index.js @@ -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'); }; diff --git a/templates/typescript/app.ts b/templates/typescript/app.ts index 63f0ba337..11d82f38f 100644 --- a/templates/typescript/app.ts +++ b/templates/typescript/app.ts @@ -1,8 +1,8 @@ -/// -<% if (ngRoute) { %>/// <% } %> -/// -/// -/// +/// <% if (ngCookies) { %> +/// <% } %><% if (ngResource) { %> +/// <% } %><% if (ngSanitize) { %> +/// <% } %><% if (ngRoute) { %> +/// <% } %> 'use strict';