Skip to content

Commit

Permalink
feat(mobile): add app shell to mobile blueprint (#809)
Browse files Browse the repository at this point in the history
  • Loading branch information
kara authored and hansl committed May 18, 2016
1 parent 289c9bd commit e7d7ed8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
8 changes: 5 additions & 3 deletions addon/ng2/blueprints/mobile/files/__path__/main-app-shell.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {provide} from '@angular/core';
import {APP_BASE_HREF} from '@angular/common';
import {<%= jsComponentName %>AppComponent} from './app/';
import { provide } from '@angular/core';
import { APP_BASE_HREF } from '@angular/common';
import { APP_SHELL_BUILD_PROVIDERS } from '@angular/app-shell';
import { <%= jsComponentName %>AppComponent } from './app/';
import {
REQUEST_URL,
ORIGIN_URL
Expand All @@ -12,6 +13,7 @@ export const options = {
<%= jsComponentName %>AppComponent
],
platformProviders: [
APP_SHELL_BUILD_PROVIDERS,
provide(ORIGIN_URL, {
useValue: ''
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component } from '@angular/core';
import { Component } from '@angular/core';<% if (isMobile) { %>
import { APP_SHELL_DIRECTIVES } from '@angular/app-shell';<% } %>

@Component({
moduleId: module.id,
Expand All @@ -8,7 +9,8 @@ import { Component } from '@angular/core';
{{title}}
</h1>
`,
styles: []<% } else { %>templateUrl: '<%= htmlComponentName %>.component.html',
styles: [],
directives: [APP_SHELL_DIRECTIVES]<% } else { %>templateUrl: '<%= htmlComponentName %>.component.html',
styleUrls: ['<%= dasherizedModuleName %>.component.css']<% } %>
})
export class <%= jsComponentName %>AppComponent {
Expand Down
6 changes: 4 additions & 2 deletions addon/ng2/blueprints/ng2/files/__path__/main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { bootstrap } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { <%= jsComponentName %>AppComponent, environment } from './app/';
import { <%= jsComponentName %>AppComponent, environment } from './app/';<% if(isMobile) { %>
import { APP_SHELL_RUNTIME_PROVIDERS } from '@angular/app-shell';<% } %>

if (environment.production) {
enableProdMode();
}

bootstrap(<%= jsComponentName %>AppComponent);
bootstrap(<%= jsComponentName %>AppComponent<% if(isMobile) { %>, [ APP_SHELL_RUNTIME_PROVIDERS ]<% } %>);

3 changes: 2 additions & 1 deletion addon/ng2/blueprints/ng2/files/__path__/system-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const barrels: string[] = [
'@angular/http',
'@angular/router',
'@angular/platform-browser',
'@angular/platform-browser-dynamic',
'@angular/platform-browser-dynamic',<% if(isMobile) { %>
'@angular/app-shell', <% } %>

// Thirdparty barrels.
'rxjs',
Expand Down
1 change: 1 addition & 0 deletions addon/ng2/blueprints/ng2/files/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@angular/platform-server": "2.0.0-rc.1",
"@angular/router-deprecated": "2.0.0-rc.1",
"@angular/service-worker": "^0.2.0",
"@angular/app-shell": "^0.0.0",
"angular2-broccoli-prerender": "^0.11.0",
"angular2-universal":"^0.100.3",
"angular2-universal-polyfills": "^0.4.1",
Expand Down

0 comments on commit e7d7ed8

Please sign in to comment.