Skip to content

Commit 59ec6d3

Browse files
authored
feat(AoT): ✨ ✨ added initial AoT support any many other things (TrilonIO#151)
* wip - aot upgrade currently facing issues like angular/angular-cli#5802 cannot find browser-app.module.ngfactory * feat(AoT): ✨ ✨ added initial AoT support any many other things Added Bootstrap with SCSS / SASS support Added ng2-bootstrap Passing Server originURL so that URLs can use it (when 4.1 comes out with HttpInterceptors this will be even easier to do) ✨ AoT added ! for prod (npm run build:aot) - Still need to test this for Azure deployments etc Removed es6-shim added core-js
1 parent 372ceeb commit 59ec6d3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+91996
-368
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# http://editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
indent_style = space
8+
indent_size = 2
9+
end_of_line = lf
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true
12+
13+
[*.md]
14+
insert_final_newline = false
15+
trim_trailing_whitespace = false

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
*.userprefs
1414

1515
# yarn
16-
.yarn.lock
16+
yarn.lock
17+
18+
npm-debug.log.*
1719

1820
# Build results
1921
[Dd]ebug/

Asp2017.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
<!-- Files not to publish (note that the 'dist' subfolders are re-added below) -->
2121
<Content Remove="Client\**" />
2222
</ItemGroup>
23+
<ItemGroup>
24+
<Content Include="Client\tsconfig.browser.json" />
25+
<Content Include="Client\tsconfig.server.aot.json" />
26+
<Content Include="Client\tsconfig.server.json" />
27+
</ItemGroup>
2328
<Target Name="RunWebpack" AfterTargets="ComputeFilesToPublish">
2429
<!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
2530
<Exec Command="npm install" />

Client/app/app.component.css

Whitespace-only changes.

Client/app/app.component.scss

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
/* Import Bootstrap & Fonts */
3+
$icon-font-path: '~bootstrap-sass/assets/fonts/bootstrap/';
4+
@import "~bootstrap-sass/assets/stylesheets/bootstrap";
5+
6+
7+
/* *** Overall APP Styling can go here ***
8+
--------------------------------------------
9+
Note: This Component has ViewEncapsulation.None so the styles will bleed out
10+
11+
*/
12+
13+
body { background: #f1f1f1; line-height: 18px; }
14+
ul { padding: 10px 25px; }
15+
ul li { padding: 5px 0; }
16+
17+
h1 { border-bottom: 5px #4189C7 solid; }
18+
h1, h2, h3 { padding: 10px 0; }
19+
20+
blockquote { margin: 25px 10px; padding: 10px 35px 10px 10px; border-left: 10px #158a15 solid; background: #edffed; }
21+
blockquote a, blockquote a:hover { color: #068006; }

Client/app/app.component.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, OnInit, OnDestroy, Inject, ViewEncapsulation, RendererFactory2, PLATFORM_ID } from '@angular/core';
1+
import { Component, OnInit, OnDestroy, Inject, ViewEncapsulation, RendererFactory2, PLATFORM_ID } from '@angular/core';
22
import { Router, NavigationEnd, ActivatedRoute, PRIMARY_OUTLET } from '@angular/router';
33
import { Meta, Title, DOCUMENT, MetaDefinition } from '@angular/platform-browser';
44
import { Subscription } from 'rxjs/Subscription';
@@ -8,7 +8,8 @@ import { LinkService } from './shared/link.service';
88
@Component({
99
selector: 'app',
1010
templateUrl: './app.component.html',
11-
styleUrls: ['./app.component.css']
11+
styleUrls: ['./app.component.scss'],
12+
encapsulation: ViewEncapsulation.None
1213
})
1314
export class AppComponent implements OnInit, OnDestroy {
1415

@@ -17,16 +18,14 @@ export class AppComponent implements OnInit, OnDestroy {
1718
// If no Title is provided, we'll use a default one before the dash(-)
1819
private defaultPageTitle: string = 'My App';
1920

20-
private sub: Subscription;
21-
private isServer: boolean = isPlatformServer(this.platform_id);
21+
private routerSub$: Subscription;
2222

2323
constructor(
24-
public router: Router,
25-
public activatedRoute: ActivatedRoute,
24+
private router: Router,
25+
private activatedRoute: ActivatedRoute,
2626
private title: Title,
2727
private meta: Meta,
28-
private linkService: LinkService,
29-
@Inject(PLATFORM_ID) private platform_id
28+
private linkService: LinkService
3029
) { }
3130

3231
ngOnInit() {
@@ -37,12 +36,12 @@ export class AppComponent implements OnInit, OnDestroy {
3736

3837
ngOnDestroy() {
3938
// Subscription clean-up
40-
this.sub.unsubscribe();
39+
this.routerSub$.unsubscribe();
4140
}
4241

4342
private _changeTitleOnNavigation() {
4443

45-
this.sub = this.router.events
44+
this.routerSub$ = this.router.events
4645
.filter(event => event instanceof NavigationEnd)
4746
.map(() => this.activatedRoute)
4847
.map(route => {

Client/app/app.module.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
import { NgModule } from '@angular/core';
1+
import { NgModule } from '@angular/core';
22
import { RouterModule } from '@angular/router';
33
import { CommonModule } from '@angular/common';
44
import { HttpModule } from '@angular/http';
55
import { FormsModule } from '@angular/forms';
66

7+
import { Ng2BootstrapModule } from 'ng2-bootstrap';
8+
79
import { AppComponent } from './app.component';
810
import { NavMenuComponent } from './components/navmenu/navmenu.component';
911
import { HomeComponent } from './containers/home/home.component';
1012
import { UsersComponent } from './containers/users/users.component';
1113
import { CounterComponent } from './containers/counter/counter.component';
1214
import { ChatComponent } from './containers/chat/chat.component';
15+
import { Ng2BootstrapComponent } from './containers/ng2-bootstrap-demo/ng2bootstrap.component';
1316

1417
import { LinkService } from './shared/link.service';
1518
import { ConnectionResolver } from './shared/route.resolver';
@@ -21,12 +24,15 @@ import { ConnectionResolver } from './shared/route.resolver';
2124
CounterComponent,
2225
UsersComponent,
2326
HomeComponent,
24-
ChatComponent
27+
ChatComponent,
28+
Ng2BootstrapComponent
2529
],
2630
imports: [
2731
CommonModule,
2832
HttpModule,
2933
FormsModule,
34+
Ng2BootstrapModule.forRoot(), // You could also split this up if you don't want the Entire Module imported
35+
3036
// App Routing
3137
RouterModule.forRoot([
3238
{
@@ -86,6 +92,18 @@ import { ConnectionResolver } from './shared/route.resolver';
8692
]
8793
}
8894
},
95+
{
96+
path: 'ng2-bootstrap', component: Ng2BootstrapComponent,
97+
data: {
98+
title: 'Ng2-bootstrap demo!!',
99+
meta: [{ name: 'description', content: 'This is an Demo Bootstrap page Description!' }],
100+
links: [
101+
{ rel: 'canonical', href: 'http://blogs.example.com/bootstrap/something' },
102+
{ rel: 'alternate', hreflang: 'es', href: 'http://es.example.com/bootstrap-demo' }
103+
]
104+
}
105+
},
106+
89107
// All else fails - go home!
90108
{ path: '**', redirectTo: 'home' }
91109
])

Client/app/browser-app.module.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ export function createConfig(): SignalRConfiguration {
2828
BrowserAnimationsModule,
2929
// Our Common AppModule
3030
AppModule,
31-
32-
SignalRModule.forRoot(() => createConfig())
31+
32+
SignalRModule.forRoot(createConfig)
3333
],
3434
providers: [
3535
{
@@ -39,5 +39,5 @@ export function createConfig(): SignalRConfiguration {
3939
}
4040
]
4141
})
42-
export class AppBrowserModule {
42+
export class BrowserAppModule {
4343
}

Client/app/components/navmenu/navmenu.component.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class='main-nav'>
1+
<div class='main-nav'>
22
<div class='navbar'>
33
<div class='navbar-header'>
44
<button type='button' class='navbar-toggle' data-toggle='collapse' data-target='.navbar-collapse'>
@@ -24,9 +24,14 @@
2424
</li>
2525
<li [routerLinkActive]="['link-active']">
2626
<a [routerLink]="['/users']">
27-
<span class='glyphicon glyphicon-user'></span> Users
27+
<span class='glyphicon glyphicon-user'></span> REST API Demo
2828
</a>
2929
</li>
30+
<li [routerLinkActive]="['link-active']">
31+
<a [routerLink]="['/ng2-bootstrap']">
32+
<span class='glyphicon glyphicon-user'></span> ng2-Bootstrap demo
33+
</a>
34+
</li>
3035
<!--<li [routerLinkActive]="['link-active']">
3136
<a [routerLink]="['/chat']">
3237
<span class='glyphicon glyphicon-comment'></span> Chat

Client/app/containers/chat/chat.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ <h2>SignalR chat example</h2>
1313
<!--<span chatMessage="chat-img pull-left">
1414
<img src="http://placehold.it/50/55C1E7/fff&text=U" alt="User Avatar" class="img-circle" />
1515
</span>-->
16+
1617
<div class="chat-body clearfix">
1718
<div class="header">
1819
<strong class="primary-font">{{message.user}}</strong>

0 commit comments

Comments
 (0)