Skip to content

Commit 57cfc06

Browse files
MarkPieszakOceansideBill
authored andcommitted
feat(Angular 5.0): update engine-etc for angular 5.0 & Domino (TrilonIO#437)
* feat(5.0): update engine-etc for angular 5.0-rc1 WIP - More updates to come * remove ng 4 references * update source maps for faster HMR builds * use aspnetcore-engine & misc updates and fixes * update to 5.0 official Closes TrilonIO#434 Closes TrilonIO#435 Closes TrilonIO#430 Closes TrilonIO#424
1 parent 2a27e02 commit 57cfc06

File tree

10 files changed

+64
-34
lines changed

10 files changed

+64
-34
lines changed

ClientApp/app/app.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { LinkService } from './shared/link.service';
99

1010
// i18n support
1111
import { TranslateService } from '@ngx-translate/core';
12-
import { REQUEST } from '@nguniversal/aspnetcore-engine/tokens';
12+
import { REQUEST } from '@nguniversal/aspnetcore-engine';
1313

1414
@Component({
1515
selector: 'app-root',

ClientApp/app/app.module.browser.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import { BrowserModule } from '@angular/platform-browser';
33
import { APP_BASE_HREF } from '@angular/common';
44
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
55

6-
<<<<<<< HEAD
7-
import { ORIGIN_URL, REQUEST } from '@nguniversal/aspnetcore-engine/tokens';
6+
import { ORIGIN_URL, REQUEST } from '@nguniversal/aspnetcore-engine';
87
import { AppModuleShared } from './app.module';
98
import { AppComponent } from './app.component';
109
import { BrowserTransferStateModule } from '@angular/platform-browser';

ClientApp/app/app.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { NgxBootstrapComponent } from './containers/ngx-bootstrap-demo/ngx-boots
2424

2525
import { LinkService } from './shared/link.service';
2626
import { UserService } from './shared/user.service';
27-
import { ORIGIN_URL } from '@nguniversal/aspnetcore-engine/tokens';
27+
import { ORIGIN_URL } from '@nguniversal/aspnetcore-engine';
2828

2929
export function createTranslateLoader(http: HttpClient, baseHref) {
3030
// Temporary Azure hack

ClientApp/app/containers/users/users.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ <h2>Users</h2>
2626
</button>
2727
</li>
2828
</ul>
29-
<app-user-detail (userUpdate)="onUserUpdate($event)" [user]="selectedUser"></app-user-detail>
29+
<app-user-detail [user]="selectedUser"></app-user-detail>

ClientApp/app/containers/users/users.component.ts

Lines changed: 53 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,30 @@ import { IUser } from '../../models/User';
1212
import { UserService } from '../../shared/user.service';
1313

1414
@Component({
15-
selector: 'app-users',
16-
templateUrl: './users.component.html',
17-
styleUrls: ['./users.component.css'],
18-
animations: [
19-
// Animation example
20-
// Triggered in the ngFor with [@flyInOut]
21-
trigger('flyInOut', [
22-
state('in', style({ transform: 'translateY(0)' })),
23-
transition('void => *', [
24-
style({ transform: 'translateY(-100%)' }),
25-
animate(1000)
26-
]),
27-
transition('* => void', [
28-
animate(1000, style({ transform: 'translateY(100%)' }))
29-
])
30-
])
31-
]
15+
selector: 'app-users',
16+
templateUrl: './users.component.html',
17+
styleUrls: ['./users.component.css'],
18+
animations: [
19+
// Animation example
20+
// Triggered in the ngFor with [@flyInOut]
21+
trigger('flyInOut', [
22+
state('in', style({ transform: 'translateY(0)' })),
23+
transition('void => *', [
24+
style({ transform: 'translateY(-100%)' }),
25+
animate(1000)
26+
]),
27+
transition('* => void', [
28+
animate(1000, style({ transform: 'translateY(100%)' }))
29+
])
30+
])
31+
]
3232
})
3333
export class UsersComponent implements OnInit {
3434

3535
users: IUser[];
3636
selectedUser: IUser;
3737

38+
<<<<<<< HEAD
3839
// Use "constructor"s only for dependency injection
3940
constructor(
4041
private userService: UserService
@@ -48,11 +49,27 @@ export class UsersComponent implements OnInit {
4849
this.users = result;
4950
});
5051
}
52+
=======
53+
// Use "constructor"s only for dependency injection
54+
constructor(
55+
private userService: UserService
56+
) { }
57+
58+
// Here you want to handle anything with @Input()'s @Output()'s
59+
// Data retrieval / etc - this is when the Component is "ready" and wired up
60+
ngOnInit() {
61+
this.userService.getUsers().subscribe(result => {
62+
console.log('HttpClient [GET] /api/users/allresult', result);
63+
this.users = result;
64+
});
65+
}
66+
>>>>>>> feat(Angular 5.0): update engine-etc for angular 5.0 & Domino (#437)
5167

5268
onSelect(user: IUser): void {
5369
this.selectedUser = user;
5470
}
5571

72+
<<<<<<< HEAD
5673
deleteUser(user) {
5774
this.clearUser();
5875
this.userService.deleteUser(user).subscribe(result => {
@@ -81,6 +98,25 @@ export class UsersComponent implements OnInit {
8198
clearUser() {
8299
if (this.selectedUser) {
83100
this.selectedUser = null;
101+
=======
102+
deleteUser(user) {
103+
this.userService.deleteUser(user).subscribe(result => {
104+
console.log('Delete user result: ', result);
105+
let position = this.users.indexOf(user);
106+
this.users.splice(position, 1);
107+
}, error => {
108+
console.log(`There was an issue. ${error._body}.`);
109+
});
110+
}
111+
112+
addUser(newUserName) {
113+
this.userService.addUser(newUserName).subscribe(result => {
114+
console.log('Post user result: ', result);
115+
this.users.push(result);
116+
}, error => {
117+
console.log(`There was an issue. ${error._body}.`);
118+
});
119+
>>>>>>> feat(Angular 5.0): update engine-etc for angular 5.0 & Domino (#437)
84120
}
85121
}
86122
}

ClientApp/app/shared/user.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Injectable, Inject, Injector } from '@angular/core';
22
import { HttpClient } from '@angular/common/http';
33
import { Http, URLSearchParams } from '@angular/http';
44
import { APP_BASE_HREF } from '@angular/common';
5-
import { ORIGIN_URL } from '@nguniversal/aspnetcore-engine/tokens';
5+
import { ORIGIN_URL } from '@nguniversal/aspnetcore-engine';
66
import { IUser } from '../models/User';
77
import { Observable } from 'rxjs';
88

ClientApp/boot.server.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ enableProdMode();
1111

1212
export default createServerRenderer((params) => {
1313

14+
console.log('server ?');
15+
1416
// Platform-server provider configuration
1517
const setupOptions: IEngineOptions = {
1618
appSelector: '<app-root></app-root>',
@@ -24,6 +26,9 @@ export default createServerRenderer((params) => {
2426

2527
return ngAspnetCoreEngine(setupOptions).then(response => {
2628

29+
// console.log('\n\n\naspnet-engine!!!\n\n\n')
30+
console.log(response)
31+
2732
// Apply your transferData to response.globals
2833
response.globals.transferData = createTransferScript({
2934
someData: 'Transfer this to the client on the window.TRANSFER_CACHE {} object',

README.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
## By [DevHelp.Online](http://www.DevHelp.Online)
44

5-
> Updated to the latest Angular 6.x
6-
7-
> Note ServerTransferModule still in the works - fix coming soon
8-
=======
95
# ASP.NET Core 2.0 & Angular 5(+) Advanced Starter - with Server-side prerendering (for Angular SEO)!
106

117
## By [DevHelp.Online](http://www.DevHelp.Online)
@@ -348,10 +344,6 @@ Well now, your Client-side Angular will take over, and you'll have a fully funct
348344

349345
> When building components in Angular 5 there are a few things to keep in mind.
350346

351-
- Make sure you provide Absolute URLs when calling any APIs. (The server can't understand relative paths, so `/api/whatever` will fail).
352-
353-
- API calls will be ran during a server, and once again during the client render, so make sure you're using transfering data that's important to you so that you don't see a flicker.
354-
355347
- **`window`**, **`document`**, **`navigator`**, and other browser types - _do not exist on the server_ - so using them, or any library that uses them (jQuery for example) will not work. You do have some options, if you truly need some of this functionality:
356348
- If you need to use them, consider limiting them to only your client and wrapping them situationally. You can use the Object injected using the PLATFORM_ID token to check whether the current platform is browser or server.
357349

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
"webpack": "^4.9.1",
6565
"webpack-hot-middleware": "^2.22.2",
6666
"webpack-merge": "^4.1.2",
67-
"zone.js": "^0.8.26"
6867
},
6968
"devDependencies": {
7069
"@angular/cli": "^6.0.5",

webpack.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ module.exports = (env) => {
101101
manifest: require('./ClientApp/dist/vendor-manifest.json'),
102102
sourceType: 'commonjs2',
103103
name: './vendor'
104-
})
105-
].concat(isDevBuild ? [
104+
}),
106105
new webpack.ContextReplacementPlugin(
107106
// fixes WARNING Critical dependency: the request of a dependency is an expression
108107
/(.+)?angular(\\|\/)core(.+)?/,

0 commit comments

Comments
 (0)