Skip to content

Commit 7489aaf

Browse files
committed
feat(mobile): add app shell to mobile blueprint
1 parent 289c9bd commit 7489aaf

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

addon/ng2/blueprints/mobile/files/__path__/main-app-shell.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {provide} from '@angular/core';
22
import {APP_BASE_HREF} from '@angular/common';
3+
import {APP_SHELL_BUILD_PROVIDERS} from '@angular/app-shell';
34
import {<%= jsComponentName %>AppComponent} from './app/';
45
import {
56
REQUEST_URL,
@@ -12,6 +13,7 @@ export const options = {
1213
<%= jsComponentName %>AppComponent
1314
],
1415
platformProviders: [
16+
APP_SHELL_BUILD_PROVIDERS,
1517
provide(ORIGIN_URL, {
1618
useValue: ''
1719
})

addon/ng2/blueprints/ng2/files/__path__/app/__name__.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Component } from '@angular/core';
1+
import { Component } from '@angular/core';<% if (isMobile) { %>
2+
import {APP_SHELL_DIRECTIVES} from '@angular/app-shell';<% } %>
23

34
@Component({
45
moduleId: module.id,
@@ -8,7 +9,8 @@ import { Component } from '@angular/core';
89
{{title}}
910
</h1>
1011
`,
11-
styles: []<% } else { %>templateUrl: '<%= htmlComponentName %>.component.html',
12+
styles: [],
13+
directives: [APP_SHELL_DIRECTIVES]<% } else { %>templateUrl: '<%= htmlComponentName %>.component.html',
1214
styleUrls: ['<%= dasherizedModuleName %>.component.css']<% } %>
1315
})
1416
export class <%= jsComponentName %>AppComponent {
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { bootstrap } from '@angular/platform-browser-dynamic';
22
import { enableProdMode } from '@angular/core';
3-
import { <%= jsComponentName %>AppComponent, environment } from './app/';
3+
import { <%= jsComponentName %>AppComponent, environment } from './app/';<% if(isMobile) { %>
4+
import {APP_SHELL_RUNTIME_PROVIDERS} from '@angular/app-shell';<% } %>
45

56
if (environment.production) {
67
enableProdMode();
78
}
89

9-
bootstrap(<%= jsComponentName %>AppComponent);
10+
bootstrap(<%= jsComponentName %>AppComponent<% if(isMobile) { %>, [ APP_SHELL_RUNTIME_PROVIDERS ]<% } %>);
11+

addon/ng2/blueprints/ng2/files/__path__/system-config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ const barrels: string[] = [
2121
'@angular/http',
2222
'@angular/router',
2323
'@angular/platform-browser',
24-
'@angular/platform-browser-dynamic',
24+
'@angular/platform-browser-dynamic',<% if(isMobile) { %>
25+
'@angular/app-shell', <% } %>
2526

2627
// Thirdparty barrels.
2728
'rxjs',

addon/ng2/blueprints/ng2/files/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"@angular/platform-server": "2.0.0-rc.1",
3131
"@angular/router-deprecated": "2.0.0-rc.1",
3232
"@angular/service-worker": "^0.2.0",
33+
"@angular/app-shell": "^0.0.0",
3334
"angular2-broccoli-prerender": "^0.11.0",
3435
"angular2-universal":"^0.100.3",
3536
"angular2-universal-polyfills": "^0.4.1",

0 commit comments

Comments
 (0)