Skip to content

Commit f5bdadf

Browse files
committed
bug(chat): removed from demo for now
1 parent c006ac3 commit f5bdadf

File tree

9 files changed

+34
-15
lines changed

9 files changed

+34
-15
lines changed

Client/app/app.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<div class='col-sm-3'>
1+
<div class="col-sm-3">
22
<nav-menu></nav-menu>
33
</div>
4-
<div class='col-sm-9 body-content'>
4+
<div class="col-sm-9 body-content">
55
<router-outlet></router-outlet>
66
</div>

Client/app/app.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { CommonModule } from '@angular/common';
44
import { HttpModule } from '@angular/http';
55

66
import { AppComponent } from './app.component';
7-
import { NavMenuComponent } from './containers/navmenu/navmenu.component';
7+
import { NavMenuComponent } from './components/navmenu/navmenu.component';
88
import { HomeComponent } from './containers/home/home.component';
99
import { FetchDataComponent } from './containers/fetchdata/fetchdata.component';
1010
import { CounterComponent } from './containers/counter/counter.component';

Client/app/browser-app.module.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { NgModule } from '@angular/core';
22
import { BrowserModule } from '@angular/platform-browser';
3+
import { APP_BASE_HREF } from '@angular/common';
34
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
45

56
import { SignalRModule, SignalRConfiguration } from 'ng2-signalr';
@@ -29,6 +30,13 @@ export function createConfig(): SignalRConfiguration {
2930
AppModule,
3031

3132
SignalRModule.forRoot(() => createConfig())
33+
],
34+
providers: [
35+
{
36+
// We need this for our
37+
provide: APP_BASE_HREF,
38+
useValue: window.location.origin
39+
}
3240
]
3341
})
3442
export class AppBrowserModule {

Client/app/containers/navmenu/navmenu.component.html renamed to Client/app/components/navmenu/navmenu.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
<span class='glyphicon glyphicon-th-list'></span> Fetch data
2828
</a>
2929
</li>
30-
<li [routerLinkActive]="['link-active']">
30+
<!--<li [routerLinkActive]="['link-active']">
3131
<a [routerLink]="['/chat']">
3232
<span class='glyphicon glyphicon-comment'></span> Chat
3333
</a>
34-
</li>
34+
</li>-->
3535
</ul>
3636
</div>
3737
</div>

Client/app/containers/fetchdata/fetchdata.component.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import {
22
Component, OnInit,
33
// animation imports
4-
trigger, state, style, transition, animate } from '@angular/core';
4+
trigger, state, style, transition, animate, Inject
5+
} from '@angular/core';
56

67
import { Http } from '@angular/http';
8+
import { APP_BASE_HREF } from '@angular/common';
79

810
@Component({
911
selector: 'fetchdata',
@@ -28,12 +30,15 @@ export class FetchDataComponent implements OnInit {
2830
public users: IUser[];
2931

3032
// Use "constructor"s only for dependency injection
31-
constructor(private http: Http) { }
33+
constructor(
34+
private http: Http,
35+
@Inject(APP_BASE_HREF) private baseHref: string
36+
) { }
3237

3338
// Here you want to handle anything with @Input()'s @Output()'s
3439
// Data retrieval / etc - this is when the Component is "ready" and wired up
3540
ngOnInit() {
36-
this.http.get('http://localhost:5000/%3C/span%3Eapi/test/users%3Cspan%20class="x x-first x-last">').map(res => res.json()).subscribe(result => {
41+
this.http.get(`${this.baseHref}/api/test/users`).map(res => res.json()).subscribe(result => {
3742
console.log(result);
3843
this.users = result as IUser[];
3944
});

Client/boot-server.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import './polyfills/server.polyfills';
22
import { enableProdMode } from '@angular/core';
33
import { INITIAL_CONFIG } from '@angular/platform-server';
4+
import { APP_BASE_HREF } from '@angular/common';
45
import { createServerRenderer, RenderResult } from 'aspnet-prerendering';
56
// Grab the (Node) server-specific NgModule
67
import { AppServerModule } from './app/server-app.module';
@@ -12,13 +13,18 @@ enableProdMode();
1213
export default createServerRenderer(params => {
1314

1415
// Platform-server provider configuration
15-
const providers = [{
16-
provide: INITIAL_CONFIG,
17-
useValue: {
18-
document: '<app></app>', // Our Root application document
19-
url: params.url
16+
const providers = [
17+
{
18+
provide: INITIAL_CONFIG,
19+
useValue: {
20+
document: '<app></app>', // Our Root application document
21+
url: params.url
22+
}
23+
}, {
24+
provide: APP_BASE_HREF,
25+
useValue: params.origin
2026
}
21-
}];
27+
];
2228

2329
return ngAspnetCoreEngine(providers, AppServerModule).then(response => {
2430
return ({

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
"aspnet-webpack": "^1.0.17",
2828
"awesome-typescript-loader": "^3.0.0",
2929
"bootstrap": "^3.3.7",
30+
"core-js": "^2.4.1",
3031
"css": "^2.2.1",
3132
"css-loader": "^0.25.0",
32-
"es6-shim": "^0.35.1",
3333
"event-source-polyfill": "^0.0.7",
3434
"expose-loader": "^0.7.1",
3535
"extract-text-webpack-plugin": "^2.0.0-rc",

0 commit comments

Comments
 (0)