diff --git a/packages/schematics/angular/angular-app/helper-files/app.component.html b/packages/schematics/angular/angular-app/helper-files/app.component.html
new file mode 100644
index 0000000000..c102540142
--- /dev/null
+++ b/packages/schematics/angular/angular-app/helper-files/app.component.html
@@ -0,0 +1,21 @@
+
+
+
+ Welcome to {{title}}!!
+
+

+
+Here are some links to help you start:
+
+<% if (routing) { %>
+<% } %>
diff --git a/packages/schematics/angular/angular-app/index.ts b/packages/schematics/angular/angular-app/index.ts
index e39121807f..f66ecda616 100644
--- a/packages/schematics/angular/angular-app/index.ts
+++ b/packages/schematics/angular/angular-app/index.ts
@@ -8,6 +8,7 @@
// TODO: replace `options: any` with an actual type generated from the schema.
// tslint:disable:no-any
import {
+ MergeStrategy,
Rule,
Tree,
apply,
@@ -76,5 +77,10 @@ export default function (options: any): Rule {
flat: true,
}),
addBootstrapToNgModule(options.directory),
+ mergeWith(
+ apply(url('./helper-files'), [
+ template({ utils: stringUtils, ...options }),
+ move(options.directory + '/' + options.sourceDir + '/app'),
+ ]), MergeStrategy.Overwrite),
]);
};
diff --git a/packages/schematics/angular/component/index.ts b/packages/schematics/angular/component/index.ts
index 67d38c06a0..3e7f68724b 100644
--- a/packages/schematics/angular/component/index.ts
+++ b/packages/schematics/angular/component/index.ts
@@ -27,7 +27,7 @@ import * as stringUtils from '../strings';
import 'rxjs/add/operator/merge';
import * as ts from 'typescript';
-import {buildRelativePath, findModule} from '../utility/find-module';
+import { buildRelativePath, findModule } from '../utility/find-module';
function addDeclarationToNgModule(options: any): Rule {
@@ -36,7 +36,15 @@ function addDeclarationToNgModule(options: any): Rule {
return host;
}
- const modulePath = findModule(host, options.sourceDir + '/' + options.path);
+ let modulePath;
+ if (options.module) {
+ if (!host.exists(options.module)) {
+ throw new Error(`Module specified (${options.module}) does not exist.`);
+ }
+ modulePath = options.module;
+ } else {
+ modulePath = findModule(host, options.sourceDir + '/' + options.path);
+ }
const sourceText = host.read(modulePath) !.toString('utf-8');
const source = ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true);
diff --git a/packages/schematics/angular/component/schema.json b/packages/schematics/angular/component/schema.json
index c98461aab5..48c52200d1 100644
--- a/packages/schematics/angular/component/schema.json
+++ b/packages/schematics/angular/component/schema.json
@@ -68,6 +68,12 @@
},
"selector": {
"type": "string"
+ },
+ "module": {
+ "type": "string",
+ "description": "Allows specification of the declaring module.",
+ "alias": "m",
+ "subtype": "filepath"
}
},
"required": [