Skip to content

Commit

Permalink
Show default module loading spinner
Browse files Browse the repository at this point in the history
  • Loading branch information
fboeller committed Mar 7, 2021
1 parent 7944cfb commit c0505de
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 15 deletions.
8 changes: 8 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@angular/compiler": "~11.2.0",
"@angular/core": "~11.2.0",
"@angular/forms": "^11.2.4",
"@angular/router": "^11.2.4",
"@angular/platform-browser": "^11.2.3",
"@angular/platform-browser-dynamic": "^11.2.3",
"@ngrx/effects": "^11.0.1",
Expand Down
2 changes: 1 addition & 1 deletion projects/example-app/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ <h1>Example App</h1>
<app-lightweight-example></app-lightweight-example>
<app-default-example></app-default-example>
<app-custom-loading-template-example></app-custom-loading-template-example>
<app-custom-default-loading-example></app-custom-default-loading-example>
<app-ngrx-example></app-ngrx-example>
</div>
<router-outlet></router-outlet>
12 changes: 10 additions & 2 deletions projects/example-app/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,23 @@ import { NgrxExampleModule } from './examples/ngrx-example/ngrx-example.module';
import { CustomLoadingTemplateExampleModule } from './examples/custom-loading-template-example/custom-loading-template-example.module';
import { DefaultExampleModule } from './examples/default-example/default-example.module';
import { LightweightExampleModule } from './examples/lightweight-example/lightweight-example.module';
import { CustomDefaultLoadingExampleModule } from './examples/custom-default-loading-example/custom-default-loading-example.module';
import { RouterModule } from '@angular/router';

@NgModule({
declarations: [AppComponent],
imports: [
BrowserModule,
RouterModule.forRoot([
{
path: 'custom-default-loading-example',
loadChildren: () =>
import(
'./examples/custom-default-loading-example/custom-default-loading-example.module'
).then((m) => m.CustomDefaultLoadingExampleModule),
},
]),
NgrxExampleModule,
CustomLoadingTemplateExampleModule,
CustomDefaultLoadingExampleModule,
DefaultExampleModule,
LightweightExampleModule,
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { LoadableModule } from 'projects/ngx-loadable/src/lib/angular/loadable.module';
import { LoadFormModule } from '../../load-form/load-form.module';
import { CustomDefaultLoadingExampleComponent } from './custom-default-loading-example.component';
import { LoadingSpinnerComponent } from './loading-spinner/loading-spinner.component';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';

@NgModule({
declarations: [CustomDefaultLoadingExampleComponent, LoadingSpinnerComponent],
imports: [BrowserModule, LoadFormModule, LoadableModule],
exports: [CustomDefaultLoadingExampleComponent],
imports: [
CommonModule,
LoadFormModule,
RouterModule.forChild([
{
path: '',
component: CustomDefaultLoadingExampleComponent,
},
]),
LoadableModule.forRoot({
defaultComponents: {
loading: LoadingSpinnerComponent,
},
}),
],
})
export class CustomDefaultLoadingExampleModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
position: absolute;
left: 8px;
width: 16px;
background: #fff;
background: #cccccc;
animation: lds-facebook 1.2s cubic-bezier(0, 0.5, 0.5, 1) infinite;
}
.lds-facebook div:nth-child(1) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { LoadableModule } from 'projects/ngx-loadable/src/lib/angular/loadable.module';
import { CustomLoadingTemplateExampleComponent } from './custom-loading-template-example.component';
import { LoadFormModule } from '../../load-form/load-form.module';
import { CommonModule } from '@angular/common';

@NgModule({
declarations: [CustomLoadingTemplateExampleComponent],
imports: [BrowserModule, LoadFormModule, LoadableModule],
imports: [CommonModule, LoadFormModule, LoadableModule],
exports: [CustomLoadingTemplateExampleComponent],
})
export class CustomLoadingTemplateExampleModule {}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { LoadableModule } from 'projects/ngx-loadable/src/lib/angular/loadable.module';
import { DefaultExampleComponent } from './default-example.component';
import { LoadFormModule } from '../../load-form/load-form.module';
import { CommonModule } from '@angular/common';

@NgModule({
declarations: [DefaultExampleComponent],
imports: [BrowserModule, LoadFormModule, LoadableModule],
imports: [CommonModule, LoadFormModule, LoadableModule],
exports: [DefaultExampleComponent],
})
export class DefaultExampleModule {}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { LoadableModule } from 'projects/ngx-loadable/src/lib/angular/loadable.module';
import { LightweightExampleComponent } from './lightweight-example.component';
import { LoadFormModule } from '../../load-form/load-form.module';
import { CommonModule } from '@angular/common';

@NgModule({
declarations: [LightweightExampleComponent],
imports: [BrowserModule, LoadFormModule, LoadableModule],
imports: [CommonModule, LoadFormModule, LoadableModule],
exports: [LightweightExampleComponent],
})
export class LightweightExampleModule {}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { NgrxExampleComponent } from './ngrx-example.component';
Expand All @@ -7,11 +6,12 @@ import { responseReducer } from './reducer';
import { EffectsModule } from '@ngrx/effects';
import { LoadEffects } from './effects';
import { LoadableModule } from 'projects/ngx-loadable/src/lib/angular/loadable.module';
import { CommonModule } from '@angular/common';

@NgModule({
declarations: [NgrxExampleComponent],
imports: [
BrowserModule,
CommonModule,
LoadableModule,
StoreModule.forRoot({
response: responseReducer,
Expand Down

0 comments on commit c0505de

Please sign in to comment.