* angular updated from 5.2 to 8.0

This commit is contained in:
Danyi Dávid
2019-10-23 16:23:06 +02:00
parent 0e9f2a448a
commit 0d0ed38966
27 changed files with 9779 additions and 8722 deletions

View File

@@ -1,18 +1,16 @@
import { NgModule } from '@angular/core';
import { ServerModule } from '@angular/platform-server';
import { ModuleMapLoaderModule } from '@nguniversal/module-map-ngfactory-loader';
import { AppModule } from './app.module';
import { AppComponent } from './app.component';
import { ModuleMapLoaderModule } from '@nguniversal/module-map-ngfactory-loader';
@NgModule({
imports: [
AppModule,
ServerModule,
ModuleMapLoaderModule,
],
bootstrap: [
AppComponent,
]
imports: [
AppModule,
ServerModule,
ModuleMapLoaderModule,
],
bootstrap: [AppComponent],
})
export class AppServerModule {}

View File

@@ -32,6 +32,14 @@ export class AlbumComponent implements OnInit {
property: 'og:image',
content: this.imageUrl(this.album.coverImage)
});
this.metaService.updateTag({
property: 'og:title',
content: this.album.name
});
this.metaService.updateTag({
property: 'og:description',
content: this.album.date
});
this.route.params.subscribe((params: {
slug: string,
image: string

View File

@@ -93,7 +93,7 @@ export class DisplayImageComponent implements OnInit {
}
@HostListener('document:keyup', ['$event.key'])
private handleKeyPress(keyPressed: string) {
public handleKeyPress(keyPressed: string) {
if (this.visible) {
switch (keyPressed) {
case 'Escape':
@@ -112,20 +112,20 @@ export class DisplayImageComponent implements OnInit {
}
@HostListener('click')
private handleClick() {
public handleClick() {
if (this.visible) {
this.nextImage();
}
}
@HostListener('touchstart', ['$event'])
private touchStart(touchEvent: TouchEvent) {
public touchStart(touchEvent: TouchEvent) {
this.touchX = touchEvent.touches[0].clientX;
this.touchY = touchEvent.touches[0].clientY;
}
@HostListener('touchend', ['$event'])
private touchEnd(touchEvent: TouchEvent) {
public touchEnd(touchEvent: TouchEvent) {
let xDiff: number = this.touchX - touchEvent.changedTouches[0].clientX;
let yDiff: number = this.touchY - touchEvent.changedTouches[0].clientY;
@@ -145,7 +145,7 @@ export class DisplayImageComponent implements OnInit {
}
@HostListener('touchcancel')
private touchCancel() {
public touchCancel() {
this.touchX = 0;
this.touchY = 0;
}

View File

@@ -1,11 +1,10 @@
import { Injectable } from '@angular/core';
import { HttpClient } from "@angular/common/http";
import { ActivatedRouteSnapshot, Resolve } from "@angular/router";
import { Observable } from "rxjs/Observable";
import 'rxjs/Rx';
import { Observable } from "rxjs";
import { environment } from "../../../environments/environment";
import { Album, Image } from ".";
import { Album } from "./album.model";
@Injectable()
export class GalleryService implements Resolve<Array<Album>|false> {

View File

@@ -9,6 +9,7 @@
<meta name="og:description" content="A really simple photo album"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="assets/css/font-awesome.min.css">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>

12
src/main.server.ts Normal file
View File

@@ -0,0 +1,12 @@
import { enableProdMode } from '@angular/core';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
export { AppServerModule } from './app/app.server.module';
export { ngExpressEngine } from "@nguniversal/express-engine";
export { provideModuleMap } from "@nguniversal/module-map-ngfactory-loader";

View File

@@ -8,4 +8,6 @@ if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule);
document.addEventListener('DOMContentLoaded', () => {
platformBrowserDynamic().bootstrapModule(AppModule);
});

View File

@@ -38,8 +38,8 @@
// import 'classlist.js'; // Run `npm install --save classlist.js`.
/** Evergreen browsers require these. **/
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';
//import 'core-js/es6/reflect';
//import 'core-js/es7/reflect';
/**

View File

@@ -1,16 +0,0 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "./",
"module": "commonjs",
"types": []
},
"exclude": [
"test.ts",
"**/*.spec.ts"
],
"angularCompilerOptions": {
"entryModule": "app/app.server.module#AppServerModule"
}
}

View File

@@ -2,10 +2,15 @@
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "./",
"module": "es2015",
"types": []
},
"files": [
"main.ts",
"polyfills.ts"
],
"include": [
"**/*.ts"
],
"exclude": [
"test.ts",
"**/*.spec.ts"

13
src/tsconfig.server.json Normal file
View File

@@ -0,0 +1,13 @@
{
"extends": "./tsconfig.app.json",
"compilerOptions": {
"outDir": "../out-tsc/app-server",
"module": "commonjs"
},
"files": [
"main.server.ts"
],
"angularCompilerOptions": {
"entryModule": "./app/app.server.module#AppServerModule"
}
}

View File

@@ -2,16 +2,14 @@
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"baseUrl": "./",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"node"
]
},
"files": [
"test.ts"
"test.ts",
"polyfills.ts"
],
"include": [
"**/*.spec.ts",