diff --git a/.editorconfig b/.editorconfig
index f1cc3ad3..90bafbc1 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,15 +1,196 @@
-# http://editorconfig.org
-
+###############################
+# Core EditorConfig Options #
+###############################
root = true
+# All files
[*]
-charset = utf-8
indent_style = space
-indent_size = 2
-end_of_line = lf
+
+# Code files
+[*.{cs,csx,vb,vbx}]
+indent_size = 4
insert_final_newline = true
-trim_trailing_whitespace = true
+charset = utf-8-bom
[*.md]
insert_final_newline = false
trim_trailing_whitespace = false
+
+###############################
+# .NET Coding Conventions #
+###############################
+
+# Solution Files
+[*.sln]
+indent_style = tab
+
+# XML Project Files
+[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
+indent_size = 2
+
+# Configuration Files
+[*.{json,xml,yml,config,props,targets,nuspec,resx,ruleset,vsixmanifest,vsct}]
+indent_size = 2
+
+# Dotnet Code Style Settings
+# See https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference
+# See http://kent-boogaart.com/blog/editorconfig-reference-for-c-developers
+[*.{cs,csx,cake,vb}]
+dotnet_sort_system_directives_first = true:warning
+dotnet_style_coalesce_expression = true:warning
+dotnet_style_collection_initializer = true:warning
+dotnet_style_explicit_tuple_names = true:warning
+dotnet_style_null_propagation = true:warning
+dotnet_style_object_initializer = true:warning
+dotnet_style_predefined_type_for_locals_parameters_members = true:warning
+dotnet_style_predefined_type_for_member_access = true:warning
+dotnet_style_qualification_for_event = true:warning
+dotnet_style_qualification_for_field = true:warning
+dotnet_style_qualification_for_method = true:warning
+dotnet_style_qualification_for_property = true:warning
+
+# Naming Symbols
+# constant_fields - Define constant fields
+dotnet_naming_symbols.constant_fields.applicable_kinds = field
+dotnet_naming_symbols.constant_fields.required_modifiers = const
+# non_private_readonly_fields - Define public, internal and protected readonly fields
+dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, internal, protected
+dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field
+dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly
+# static_readonly_fields - Define static and readonly fields
+dotnet_naming_symbols.static_readonly_fields.applicable_kinds = field
+dotnet_naming_symbols.static_readonly_fields.required_modifiers = static, readonly
+# private_readonly_fields - Define private readonly fields
+dotnet_naming_symbols.private_readonly_fields.applicable_accessibilities = private
+dotnet_naming_symbols.private_readonly_fields.applicable_kinds = field
+dotnet_naming_symbols.private_readonly_fields.required_modifiers = readonly
+# public_internal_fields - Define public and internal fields
+dotnet_naming_symbols.public_internal_fields.applicable_accessibilities = public, internal
+dotnet_naming_symbols.public_internal_fields.applicable_kinds = field
+# private_protected_fields - Define private and protected fields
+dotnet_naming_symbols.private_protected_fields.applicable_accessibilities = private, protected
+dotnet_naming_symbols.private_protected_fields.applicable_kinds = field
+# public_symbols - Define any public symbol
+dotnet_naming_symbols.public_symbols.applicable_accessibilities = public, internal, protected, protected_internal
+dotnet_naming_symbols.public_symbols.applicable_kinds = method, property, event, delegate
+# parameters - Defines any parameter
+dotnet_naming_symbols.parameters.applicable_kinds = parameter
+# non_interface_types - Defines class, struct, enum and delegate types
+dotnet_naming_symbols.non_interface_types.applicable_kinds = class, struct, enum, delegate
+# interface_types - Defines interfaces
+dotnet_naming_symbols.interface_types.applicable_kinds = interface
+
+# Naming Styles
+# camel_case - Define the camelCase style
+dotnet_naming_style.camel_case.capitalization = camel_case
+# pascal_case - Define the Pascal_case style
+dotnet_naming_style.pascal_case.capitalization = pascal_case
+# first_upper - The first character must start with an upper-case character
+dotnet_naming_style.first_upper.capitalization = first_word_upper
+# prefix_interface_interface_with_i - Interfaces must be PascalCase and the first character of an interface must be an 'I'
+dotnet_naming_style.prefix_interface_interface_with_i.capitalization = pascal_case
+dotnet_naming_style.prefix_interface_interface_with_i.required_prefix = I
+
+# Naming Rules
+# Constant fields must be PascalCase
+dotnet_naming_rule.constant_fields_must_be_pascal_case.severity = warning
+dotnet_naming_rule.constant_fields_must_be_pascal_case.symbols = constant_fields
+dotnet_naming_rule.constant_fields_must_be_pascal_case.style = pascal_case
+# Public, internal and protected readonly fields must be PascalCase
+dotnet_naming_rule.non_private_readonly_fields_must_be_pascal_case.severity = warning
+dotnet_naming_rule.non_private_readonly_fields_must_be_pascal_case.symbols = non_private_readonly_fields
+dotnet_naming_rule.non_private_readonly_fields_must_be_pascal_case.style = pascal_case
+# Static readonly fields must be PascalCase
+dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.severity = warning
+dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.symbols = static_readonly_fields
+dotnet_naming_rule.static_readonly_fields_must_be_pascal_case.style = pascal_case
+# Private readonly fields must be camelCase
+dotnet_naming_rule.private_readonly_fields_must_be_camel_case.severity = warning
+dotnet_naming_rule.private_readonly_fields_must_be_camel_case.symbols = private_readonly_fields
+dotnet_naming_rule.private_readonly_fields_must_be_camel_case.style = camel_case
+# Public and internal fields must be PascalCase
+dotnet_naming_rule.public_internal_fields_must_be_pascal_case.severity = warning
+dotnet_naming_rule.public_internal_fields_must_be_pascal_case.symbols = public_internal_fields
+dotnet_naming_rule.public_internal_fields_must_be_pascal_case.style = pascal_case
+# Private and protected fields must be camelCase
+dotnet_naming_rule.private_protected_fields_must_be_camel_case.severity = warning
+dotnet_naming_rule.private_protected_fields_must_be_camel_case.symbols = private_protected_fields
+dotnet_naming_rule.private_protected_fields_must_be_camel_case.style = camel_case
+# Public members must be capitalized
+dotnet_naming_rule.public_members_must_be_capitalized.severity = warning
+dotnet_naming_rule.public_members_must_be_capitalized.symbols = public_symbols
+dotnet_naming_rule.public_members_must_be_capitalized.style = first_upper
+# Parameters must be camelCase
+dotnet_naming_rule.parameters_must_be_camel_case.severity = warning
+dotnet_naming_rule.parameters_must_be_camel_case.symbols = parameters
+dotnet_naming_rule.parameters_must_be_camel_case.style = camel_case
+# Class, struct, enum and delegates must be PascalCase
+dotnet_naming_rule.non_interface_types_must_be_pascal_case.severity = warning
+dotnet_naming_rule.non_interface_types_must_be_pascal_case.symbols = non_interface_types
+dotnet_naming_rule.non_interface_types_must_be_pascal_case.style = pascal_case
+# Interfaces must be PascalCase and start with an 'I'
+dotnet_naming_rule.interface_types_must_be_prefixed_with_i.severity = warning
+dotnet_naming_rule.interface_types_must_be_prefixed_with_i.symbols = interface_types
+dotnet_naming_rule.interface_types_must_be_prefixed_with_i.style = prefix_interface_interface_with_i
+
+# C# Code Style Settings
+# See https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference
+# See http://kent-boogaart.com/blog/editorconfig-reference-for-c-developers
+[*.{cs,csx,cake}]
+# Indentation Options
+csharp_indent_block_contents = true:warning
+csharp_indent_braces = false:warning
+csharp_indent_case_contents = true:warning
+csharp_indent_labels = no_change:warning
+csharp_indent_switch_labels = true:warning
+# Style Options
+csharp_style_conditional_delegate_call = true:warning
+csharp_style_expression_bodied_accessors = true:warning
+csharp_style_expression_bodied_constructors = true:warning
+csharp_style_expression_bodied_indexers = true:warning
+csharp_style_expression_bodied_methods = true:warning
+csharp_style_expression_bodied_operators = true:warning
+csharp_style_expression_bodied_properties = true:warning
+csharp_style_inlined_variable_declaration = true:warning
+csharp_style_pattern_matching_over_as_with_null_check = true:warning
+csharp_style_pattern_matching_over_is_with_cast_check = true:warning
+csharp_style_throw_expression = true:warning
+csharp_style_var_elsewhere = true:warning
+csharp_style_var_for_built_in_types = true:warning
+csharp_style_var_when_type_is_apparent = true:warning
+# New Line Options
+csharp_new_line_before_catch = true:warning
+csharp_new_line_before_else = true:warning
+csharp_new_line_before_finally = true:warning
+csharp_new_line_before_members_in_anonymous_types = true:warning
+csharp_new_line_before_members_in_object_initializers = true:warning
+# BUG: Warning level cannot be set https://github.com/dotnet/roslyn/issues/18010
+csharp_new_line_before_open_brace = all
+csharp_new_line_between_query_expression_clauses = true:warning
+# Spacing Options
+csharp_space_after_cast = false:warning
+csharp_space_after_colon_in_inheritance_clause = true:warning
+csharp_space_after_comma = true:warning
+csharp_space_after_dot = false:warning
+csharp_space_after_keywords_in_control_flow_statements = true:warning
+csharp_space_after_semicolon_in_for_statement = true:warning
+csharp_space_around_binary_operators = before_and_after:warning
+csharp_space_around_declaration_statements = do_not_ignore:warning
+csharp_space_before_colon_in_inheritance_clause = true:warning
+csharp_space_before_comma = false:warning
+csharp_space_before_dot = false:warning
+csharp_space_before_semicolon_in_for_statement = false:warning
+csharp_space_before_open_square_brackets = false:warning
+csharp_space_between_empty_square_brackets = false:warning
+csharp_space_between_method_declaration_name_and_open_parenthesis = false:warning
+csharp_space_between_method_declaration_parameter_list_parentheses = false:warning
+csharp_space_between_method_declaration_empty_parameter_list_parentheses = false:warning
+csharp_space_between_method_call_name_and_opening_parenthesis = false:warning
+csharp_space_between_method_call_parameter_list_parentheses = false:warning
+csharp_space_between_method_call_empty_parameter_list_parentheses = false:warning
+csharp_space_between_parentheses = expressions:warning
+csharp_space_between_square_brackets = false:warning
+# Wrapping Options
+csharp_preserve_single_line_blocks = true:warning
+csharp_preserve_single_line_statements = false:warning
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
index 33256db7..da1cb069 100644
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -8,7 +8,7 @@
"tasks": [
{
"taskName": "build",
- "args": [ ],
+ "args": ["Asp2017.sln"],
"isBuildCommand": true,
"showOutput": "silent",
"problemMatcher": "$msCompile"
diff --git a/Asp2017.csproj b/Asp2017.csproj
index 7db490d3..b307acba 100644
--- a/Asp2017.csproj
+++ b/Asp2017.csproj
@@ -9,11 +9,11 @@
-
+
-
-
+
+
diff --git a/ClientApp/app/_styles.scss b/ClientApp/app/_styles.scss
index 42cf15fe..87ea278f 100644
--- a/ClientApp/app/_styles.scss
+++ b/ClientApp/app/_styles.scss
@@ -1,22 +1,26 @@
$body-bg: #f1f1f1;
$body-color: #111;
-$theme-colors: ( "primary": #216DAD);
-$theme-colors: ( "accent": #669ECD);
+$theme-colors: (
+ 'primary': #216dad
+);
+$theme-colors: (
+ 'accent': #669ecd
+);
-
-@import "http://github.com/~bootstrap/scss/bootstrap";
+@import 'http://github.com/~bootstrap/scss/bootstrap';
.panel {
- box-shadow: 0 3px 1px -2px rgba(0, 0, 0, .2), 0 2px 2px 0 rgba(0, 0, 0, .14), 0 1px 5px 0 rgba(0, 0, 0, .12);
+ box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14),
+ 0 1px 5px 0 rgba(0, 0, 0, 0.12);
height: 100%;
flex: 1;
- background-color: rgba(255, 255, 255, .30);
- border-radius: .25rem;
+ background-color: rgba(255, 255, 255, 0.3);
+ border-radius: 0.25rem;
.title {
background-color: #86afd0;
- color: #FFFFFF;
+ color: #ffffff;
text-align: center;
- border-top-left-radius: .25rem;
- border-top-right-radius: .25rem;
+ border-top-left-radius: 0.25rem;
+ border-top-right-radius: 0.25rem;
}
.body {
display: flex;
diff --git a/ClientApp/app/_variables.scss b/ClientApp/app/_variables.scss
index 2d34745a..313015eb 100644
--- a/ClientApp/app/_variables.scss
+++ b/ClientApp/app/_variables.scss
@@ -1,6 +1,6 @@
-@import "http://github.com/styles";
-$header-height:50px;
-$menu-max-width:25%;
+@import 'http://github.com/styles';
+$header-height: 50px;
+$menu-max-width: 25%;
$navbar-default-bg: #312312;
$light-orange: #ff8c00;
$navbar-default-color: $light-orange;
diff --git a/ClientApp/app/app.component.scss b/ClientApp/app/app.component.scss
index 8705be92..1e7eea64 100644
--- a/ClientApp/app/app.component.scss
+++ b/ClientApp/app/app.component.scss
@@ -1,4 +1,4 @@
-@import "http://github.com/variables";
+@import 'http://github.com/variables';
/* *** Overall APP Styling can go here ***
--------------------------------------------
Note: This Component has ViewEncapsulation.None so the styles will bleed out
@@ -15,7 +15,7 @@ body {
}
h1 {
- border-bottom: 3px theme-color("accent") solid;
+ border-bottom: 3px theme-color('accent') solid;
font-size: 24px;
}
@@ -40,7 +40,7 @@ ul li {
blockquote {
margin: 25px 10px;
padding: 10px 35px 10px 10px;
- border-left: 10px color("green") solid;
+ border-left: 10px color('green') solid;
background: $gray-100;
}
@@ -57,7 +57,7 @@ blockquote a:hover {
margin-left: $menu-max-width;
}
h1 {
- border-bottom: 5px #4189C7 solid;
+ border-bottom: 5px #4189c7 solid;
font-size: 36px;
}
h2 {
diff --git a/ClientApp/app/app.component.ts b/ClientApp/app/app.component.ts
index 614cba3e..415c196a 100644
--- a/ClientApp/app/app.component.ts
+++ b/ClientApp/app/app.component.ts
@@ -1,101 +1,103 @@
-
-import {mergeMap, map, filter} from 'rxjs/operators';
-import { Component, OnInit, OnDestroy, Inject, ViewEncapsulation, RendererFactory2, PLATFORM_ID, Injector } from '@angular/core';
-import { Router, NavigationEnd, ActivatedRoute, PRIMARY_OUTLET } from '@angular/router';
-import { Meta, Title, DOCUMENT, MetaDefinition } from '@angular/platform-browser';
-import { Subscription } from 'rxjs';
-import { isPlatformServer } from '@angular/common';
-import { LinkService } from './shared/link.service';
-
+import {
+ Component,
+ Injector,
+ OnDestroy,
+ OnInit,
+ ViewEncapsulation
+} from '@angular/core';
+import { Meta, Title } from '@angular/platform-browser';
+import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
+import { REQUEST } from '@nguniversal/aspnetcore-engine/tokens';
// i18n support
import { TranslateService } from '@ngx-translate/core';
-import { REQUEST } from '@nguniversal/aspnetcore-engine/tokens';
+import { Subscription } from 'rxjs';
+import { filter, map, mergeMap } from 'rxjs/operators';
+import { LinkService } from './shared/link.service';
@Component({
- selector: 'app-root',
- templateUrl: './app.component.html',
- styleUrls: ['./app.component.scss'],
- encapsulation: ViewEncapsulation.None
+ selector: 'app-root',
+ templateUrl: './app.component.html',
+ styleUrls: ['./app.component.scss'],
+ encapsulation: ViewEncapsulation.None
})
export class AppComponent implements OnInit, OnDestroy {
-
- // This will go at the END of your title for example "Home - Angular Universal..." <-- after the dash (-)
- private endPageTitle: string = 'Angular Universal and ASP.NET Core Starter';
- // If no Title is provided, we'll use a default one before the dash(-)
- private defaultPageTitle: string = 'My App';
-
- private routerSub$: Subscription;
- private request;
-
- constructor(
- private router: Router,
- private activatedRoute: ActivatedRoute,
- private title: Title,
- private meta: Meta,
- private linkService: LinkService,
- public translate: TranslateService,
- private injector: Injector
- ) {
- // this language will be used as a fallback when a translation isn't found in the current language
- translate.setDefaultLang('en');
-
- // the lang to use, if the lang isn't available, it will use the current loader to get them
- translate.use('en');
-
- this.request = this.injector.get(REQUEST);
-
- console.log(`What's our REQUEST Object look like?`);
- console.log(`The Request object only really exists on the Server, but on the Browser we can at least see Cookies`);
- console.log(this.request);
+ // This will go at the END of your title for example "Home - Angular Universal..." <-- after the dash (-)
+ private endPageTitle: string = 'Angular Universal and ASP.NET Core Starter';
+ // If no Title is provided, we'll use a default one before the dash(-)
+ private defaultPageTitle: string = 'My App';
+
+ private routerSub$: Subscription;
+ private request;
+
+ constructor(
+ private router: Router,
+ private activatedRoute: ActivatedRoute,
+ private title: Title,
+ private meta: Meta,
+ private linkService: LinkService,
+ public translate: TranslateService,
+ private injector: Injector
+ ) {
+ // this language will be used as a fallback when a translation isn't found in the current language
+ translate.setDefaultLang('en');
+
+ // the lang to use, if the lang isn't available, it will use the current loader to get them
+ translate.use('en');
+
+ this.request = this.injector.get(REQUEST);
+
+ console.log(`What's our REQUEST Object look like?`);
+ console.log(
+ `The Request object only really exists on the Server, but on the Browser we can at least see Cookies`
+ );
+ console.log(this.request);
+ }
+
+ ngOnInit() {
+ // Change "Title" on every navigationEnd event
+ // Titles come from the data.title property on all Routes (see app.routes.ts)
+ this._changeTitleOnNavigation();
+ }
+
+ ngOnDestroy() {
+ // Subscription clean-up
+ this.routerSub$.unsubscribe();
+ }
+
+ private _changeTitleOnNavigation() {
+ this.routerSub$ = this.router.events
+ .pipe(
+ filter(event => event instanceof NavigationEnd),
+ map(() => this.activatedRoute),
+ map(route => {
+ while (route.firstChild) route = route.firstChild;
+ return route;
+ }),
+ filter(route => route.outlet === 'primary'),
+ mergeMap(route => route.data)
+ )
+ .subscribe(event => {
+ this._setMetaAndLinks(event);
+ });
+ }
+
+ private _setMetaAndLinks(event) {
+ // Set Title if available, otherwise leave the default Title
+ const title = event['title']
+ ? `${event['title']} - ${this.endPageTitle}`
+ : `${this.defaultPageTitle} - ${this.endPageTitle}`;
+
+ this.title.setTitle(title);
+
+ const metaData = event['meta'] || [];
+ const linksData = event['links'] || [];
+
+ for (let i = 0; i < metaData.length; i++) {
+ this.meta.updateTag(metaData[i]);
}
- ngOnInit() {
- // Change "Title" on every navigationEnd event
- // Titles come from the data.title property on all Routes (see app.routes.ts)
- this._changeTitleOnNavigation();
+ for (let i = 0; i < linksData.length; i++) {
+ this.linkService.addTag(linksData[i]);
}
-
- ngOnDestroy() {
- // Subscription clean-up
- this.routerSub$.unsubscribe();
- }
-
- private _changeTitleOnNavigation() {
-
- this.routerSub$ = this.router.events.pipe(
- filter(event => event instanceof NavigationEnd),
- map(() => this.activatedRoute),
- map(route => {
- while (route.firstChild) route = route.firstChild;
- return route;
- }),
- filter(route => route.outlet === 'primary'),
- mergeMap(route => route.data),)
- .subscribe((event) => {
- this._setMetaAndLinks(event);
- });
- }
-
- private _setMetaAndLinks(event) {
-
- // Set Title if available, otherwise leave the default Title
- const title = event['title']
- ? `${event['title']} - ${this.endPageTitle}`
- : `${this.defaultPageTitle} - ${this.endPageTitle}`;
-
- this.title.setTitle(title);
-
- const metaData = event['meta'] || [];
- const linksData = event['links'] || [];
-
- for (let i = 0; i < metaData.length; i++) {
- this.meta.updateTag(metaData[i]);
- }
-
- for (let i = 0; i < linksData.length; i++) {
- this.linkService.addTag(linksData[i]);
- }
- }
-
+ }
}
-
diff --git a/ClientApp/app/app.module.browser.ts b/ClientApp/app/app.module.browser.ts
index f7371e80..5162c3ca 100644
--- a/ClientApp/app/app.module.browser.ts
+++ b/ClientApp/app/app.module.browser.ts
@@ -1,13 +1,9 @@
import { NgModule } from '@angular/core';
-import { BrowserModule } from '@angular/platform-browser';
-import { APP_BASE_HREF } from '@angular/common';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
-
import { ORIGIN_URL, REQUEST } from '@nguniversal/aspnetcore-engine/tokens';
-import { AppModuleShared } from './app.module';
-import { AppComponent } from './app.component';
-import { BrowserTransferStateModule } from '@angular/platform-browser';
import { PrebootModule } from 'preboot';
+import { AppComponent } from './app.component';
+import { AppModuleShared } from './app.module';
export function getOriginUrl() {
return window.location.origin;
@@ -19,26 +15,26 @@ export function getRequest() {
}
@NgModule({
- bootstrap: [AppComponent],
- imports: [
- PrebootModule.withConfig({ appRoot: 'app-root' }),
- BrowserAnimationsModule,
-
- // Our Common AppModule
- AppModuleShared
+ bootstrap: [AppComponent],
+ imports: [
+ PrebootModule.withConfig({ appRoot: 'app-root' }),
+ BrowserAnimationsModule,
- ],
- providers: [
- {
- // We need this for our Http calls since they'll be using an ORIGIN_URL provided in main.server
- // (Also remember the Server requires Absolute URLs)
- provide: ORIGIN_URL,
- useFactory: (getOriginUrl)
- }, {
- // The server provides these in main.server
- provide: REQUEST,
- useFactory: (getRequest)
- }
- ]
+ // Our Common AppModule
+ AppModuleShared
+ ],
+ providers: [
+ {
+ // We need this for our Http calls since they'll be using an ORIGIN_URL provided in main.server
+ // (Also remember the Server requires Absolute URLs)
+ provide: ORIGIN_URL,
+ useFactory: getOriginUrl
+ },
+ {
+ // The server provides these in main.server
+ provide: REQUEST,
+ useFactory: getRequest
+ }
+ ]
})
-export class AppModule { }
+export class AppModule {}
diff --git a/ClientApp/app/app.module.server.ts b/ClientApp/app/app.module.server.ts
index 642a774c..06af629a 100644
--- a/ClientApp/app/app.module.server.ts
+++ b/ClientApp/app/app.module.server.ts
@@ -1,13 +1,11 @@
import { NgModule } from '@angular/core';
-import { ServerModule } from '@angular/platform-server';
-import { BrowserModule } from '@angular/platform-browser';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
-
-import { AppModuleShared } from './app.module';
+import { ServerModule } from '@angular/platform-server';
+import { PrebootModule } from 'preboot';
import { AppComponent } from './app.component';
-import { ServerTransferStateModule } from '@angular/platform-server';
+import { AppModuleShared } from './app.module';
-import { PrebootModule } from 'preboot';
+import { TransferHttpCacheModule, StateTransferInitializerModule } from '@nguniversal/common';
@NgModule({
bootstrap: [AppComponent],
@@ -19,14 +17,12 @@ import { PrebootModule } from 'preboot';
PrebootModule.withConfig({ appRoot: 'app-root' }),
NoopAnimationsModule,
- // HttpTransferCacheModule still needs fixes for 5.0
+ TransferHttpCacheModule, // still needs fixes for 5.0
// Leave this commented out for now, as it breaks Server-renders
// Looking into fixes for this! - @MarkPieszak
- // ServerTransferStateModule // <-- broken for the time-being with ASP.NET
+ // StateTransferInitializerModule // <-- broken for the time-being with ASP.NET
]
})
export class AppModule {
-
- constructor() { }
-
+ constructor() {}
}
diff --git a/ClientApp/app/app.module.ts b/ClientApp/app/app.module.ts
index 7cc9c4c0..a30f46d8 100644
--- a/ClientApp/app/app.module.ts
+++ b/ClientApp/app/app.module.ts
@@ -1,156 +1,212 @@
-import { NgModule, Inject } from '@angular/core';
-import { RouterModule, PreloadAllModules } from '@angular/router';
-import { CommonModule, APP_BASE_HREF } from '@angular/common';
-import { HttpModule, Http } from '@angular/http';
-import { HttpClientModule, HttpClient } from '@angular/common/http';
+import { CommonModule } from '@angular/common';
+import { HttpClient, HttpClientModule } from '@angular/common/http';
+import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
-import { BrowserModule, BrowserTransferStateModule } from '@angular/platform-browser';
+import {
+ BrowserModule,
+ BrowserTransferStateModule
+} from '@angular/platform-browser';
+import { PreloadAllModules, RouterModule } from '@angular/router';
+import { ORIGIN_URL } from '@nguniversal/aspnetcore-engine/tokens';
import { TransferHttpCacheModule } from '@nguniversal/common';
-
-import { AccordionModule } from 'ngx-bootstrap';
-
// i18n support
-import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
+import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
-
+import { AccordionModule } from 'ngx-bootstrap';
import { AppComponent } from './app.component';
import { NavMenuComponent } from './components/navmenu/navmenu.component';
-import { HomeComponent } from './containers/home/home.component';
-import { UsersComponent } from './containers/users/users.component';
import { UserDetailComponent } from './components/user-detail/user-detail.component';
import { CounterComponent } from './containers/counter/counter.component';
-import { NotFoundComponent } from './containers/not-found/not-found.component';
+import { HomeComponent } from './containers/home/home.component';
import { NgxBootstrapComponent } from './containers/ngx-bootstrap-demo/ngx-bootstrap.component';
-
+import { NotFoundComponent } from './containers/not-found/not-found.component';
+import { UsersComponent } from './containers/users/users.component';
import { LinkService } from './shared/link.service';
import { UserService } from './shared/user.service';
-import { ORIGIN_URL } from '@nguniversal/aspnetcore-engine/tokens';
export function createTranslateLoader(http: HttpClient, baseHref) {
- // Temporary Azure hack
- if (baseHref === null && typeof window !== 'undefined') {
- baseHref = window.location.origin;
- }
- // i18n files are in `wwwroot/assets/`
- return new TranslateHttpLoader(http, `${baseHref}/assets/i18n/`, '.json');
+ // Temporary Azure hack
+ if (baseHref === null && typeof window !== 'undefined') {
+ baseHref = window.location.origin;
+ }
+ // i18n files are in `wwwroot/assets/`
+ return new TranslateHttpLoader(http, `${baseHref}/assets/i18n/`, '.json');
}
@NgModule({
- declarations: [
- AppComponent,
- NavMenuComponent,
- CounterComponent,
- UsersComponent,
- UserDetailComponent,
- HomeComponent,
- NotFoundComponent,
- NgxBootstrapComponent
- ],
- imports: [
- CommonModule,
- BrowserModule.withServerTransition({
- appId: 'my-app-id' // make sure this matches with your Server NgModule
- }),
- HttpClientModule,
- TransferHttpCacheModule,
- BrowserTransferStateModule,
- FormsModule,
- ReactiveFormsModule,
- AccordionModule.forRoot(), // You could also split this up if you don't want the Entire Module imported
+ declarations: [
+ AppComponent,
+ NavMenuComponent,
+ CounterComponent,
+ UsersComponent,
+ UserDetailComponent,
+ HomeComponent,
+ NotFoundComponent,
+ NgxBootstrapComponent
+ ],
+ imports: [
+ CommonModule,
+ BrowserModule.withServerTransition({
+ appId: 'my-app-id' // make sure this matches with your Server NgModule
+ }),
+ HttpClientModule,
+ TransferHttpCacheModule,
+ BrowserTransferStateModule,
+ FormsModule,
+ ReactiveFormsModule,
+ AccordionModule.forRoot(), // You could also split this up if you don't want the Entire Module imported
- // i18n support
- TranslateModule.forRoot({
- loader: {
- provide: TranslateLoader,
- useFactory: (createTranslateLoader),
- deps: [HttpClient, [ORIGIN_URL]]
- }
- }),
+ // i18n support
+ TranslateModule.forRoot({
+ loader: {
+ provide: TranslateLoader,
+ useFactory: createTranslateLoader,
+ deps: [HttpClient, [ORIGIN_URL]]
+ }
+ }),
- // App Routing
- RouterModule.forRoot([
- {
- path: '',
- redirectTo: 'home',
- pathMatch: 'full'
- },
- {
- path: 'home', component: HomeComponent,
+ // App Routing
+ RouterModule.forRoot(
+ [
+ {
+ path: '',
+ redirectTo: 'home',
+ pathMatch: 'full'
+ },
+ {
+ path: 'home',
+ component: HomeComponent,
- // *** SEO Magic ***
- // We're using "data" in our Routes to pass in our
tag information
- // Note: This is only happening for ROOT level Routes, you'd have to add some additional logic if you wanted this for Child level routing
- // When you change Routes it will automatically append these to your document for you on the Server-side
- // - check out app.component.ts to see how it's doing this
- data: {
- title: 'Homepage',
- meta: [{ name: 'description', content: 'This is an example Description Meta tag!' }],
- links: [
- { rel: 'canonical', href: 'http://blogs.example.com/blah/nice' },
- { rel: 'alternate', hreflang: 'es', href: 'http://es.example.com/' }
- ]
- }
- },
- {
- path: 'counter', component: CounterComponent,
- data: {
- title: 'Counter',
- meta: [{ name: 'description', content: 'This is an Counter page Description!' }],
- links: [
- { rel: 'canonical', href: 'http://blogs.example.com/counter/something' },
- { rel: 'alternate', hreflang: 'es', href: 'http://es.example.com/counter' }
- ]
- }
- },
- {
- path: 'users', component: UsersComponent,
- data: {
- title: 'Users REST example',
- meta: [{ name: 'description', content: 'This is User REST API example page Description!' }],
- links: [
- { rel: 'canonical', href: 'http://blogs.example.com/chat/something' },
- { rel: 'alternate', hreflang: 'es', href: 'http://es.example.com/users' }
- ]
- }
- },
- {
- path: 'ngx-bootstrap', component: NgxBootstrapComponent,
- data: {
- title: 'Ngx-bootstrap demo!!',
- meta: [{ name: 'description', content: 'This is an Demo Bootstrap page Description!' }],
- links: [
- { rel: 'canonical', href: 'http://blogs.example.com/bootstrap/something' },
- { rel: 'alternate', hreflang: 'es', href: 'http://es.example.com/bootstrap-demo' }
- ]
- }
- },
+ // *** SEO Magic ***
+ // We're using "data" in our Routes to pass in our tag information
+ // Note: This is only happening for ROOT level Routes, you'd have to add some additional logic if you wanted this for Child level routing
+ // When you change Routes it will automatically append these to your document for you on the Server-side
+ // - check out app.component.ts to see how it's doing this
+ data: {
+ title: 'Homepage',
+ meta: [
+ {
+ name: 'description',
+ content: 'This is an example Description Meta tag!'
+ }
+ ],
+ links: [
+ { rel: 'canonical', href: 'http://blogs.example.com/blah/nice' },
+ {
+ rel: 'alternate',
+ hreflang: 'es',
+ href: 'http://es.example.com/'
+ }
+ ]
+ }
+ },
+ {
+ path: 'counter',
+ component: CounterComponent,
+ data: {
+ title: 'Counter',
+ meta: [
+ {
+ name: 'description',
+ content: 'This is an Counter page Description!'
+ }
+ ],
+ links: [
+ {
+ rel: 'canonical',
+ href: 'http://blogs.example.com/counter/something'
+ },
+ {
+ rel: 'alternate',
+ hreflang: 'es',
+ href: 'http://es.example.com/counter'
+ }
+ ]
+ }
+ },
+ {
+ path: 'users',
+ component: UsersComponent,
+ data: {
+ title: 'Users REST example',
+ meta: [
+ {
+ name: 'description',
+ content: 'This is User REST API example page Description!'
+ }
+ ],
+ links: [
+ {
+ rel: 'canonical',
+ href: 'http://blogs.example.com/chat/something'
+ },
+ {
+ rel: 'alternate',
+ hreflang: 'es',
+ href: 'http://es.example.com/users'
+ }
+ ]
+ }
+ },
+ {
+ path: 'ngx-bootstrap',
+ component: NgxBootstrapComponent,
+ data: {
+ title: 'Ngx-bootstrap demo!!',
+ meta: [
+ {
+ name: 'description',
+ content: 'This is an Demo Bootstrap page Description!'
+ }
+ ],
+ links: [
+ {
+ rel: 'canonical',
+ href: 'http://blogs.example.com/bootstrap/something'
+ },
+ {
+ rel: 'alternate',
+ hreflang: 'es',
+ href: 'http://es.example.com/bootstrap-demo'
+ }
+ ]
+ }
+ },
- { path: 'lazy', loadChildren: './containers/lazy/lazy.module#LazyModule'},
+ {
+ path: 'lazy',
+ loadChildren: './containers/lazy/lazy.module#LazyModule'
+ },
- {
- path: '**', component: NotFoundComponent,
- data: {
- title: '404 - Not found',
- meta: [{ name: 'description', content: '404 - Error' }],
- links: [
- { rel: 'canonical', href: 'http://blogs.example.com/bootstrap/something' },
- { rel: 'alternate', hreflang: 'es', href: 'http://es.example.com/bootstrap-demo' }
- ]
- }
- }
- ], {
- // Router options
- useHash: false,
- preloadingStrategy: PreloadAllModules,
- initialNavigation: 'enabled'
- })
- ],
- providers: [
- LinkService,
- UserService,
- TranslateModule
- ],
- bootstrap: [AppComponent]
+ {
+ path: '**',
+ component: NotFoundComponent,
+ data: {
+ title: '404 - Not found',
+ meta: [{ name: 'description', content: '404 - Error' }],
+ links: [
+ {
+ rel: 'canonical',
+ href: 'http://blogs.example.com/bootstrap/something'
+ },
+ {
+ rel: 'alternate',
+ hreflang: 'es',
+ href: 'http://es.example.com/bootstrap-demo'
+ }
+ ]
+ }
+ }
+ ],
+ {
+ // Router options
+ useHash: false,
+ preloadingStrategy: PreloadAllModules,
+ initialNavigation: 'enabled'
+ }
+ )
+ ],
+ providers: [LinkService, UserService, TranslateModule],
+ bootstrap: [AppComponent]
})
-export class AppModuleShared {
-}
+export class AppModuleShared {}
diff --git a/ClientApp/app/components/navmenu/navmenu.component.html b/ClientApp/app/components/navmenu/navmenu.component.html
index fdef2c65..ba9ff74e 100644
--- a/ClientApp/app/components/navmenu/navmenu.component.html
+++ b/ClientApp/app/components/navmenu/navmenu.component.html
@@ -1,5 +1,5 @@