Skip to content

Instantly share code, notes, and snippets.

@mpalourdio
Last active May 2, 2022 12:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpalourdio/e05b4495de2abeeecfcf92d70e4ef93e to your computer and use it in GitHub Desktop.
Save mpalourdio/e05b4495de2abeeecfcf92d70e4ef93e to your computer and use it in GitHub Desktop.
Custom component
<router-outlet></router-outlet>
<ng-http-loader [entryComponent]="awesomeComponent" ></ng-http-loader>
import { Component } from '@angular/core';
import { AwesomeComponent } from 'my.awesome.component';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
public awesomeComponent = AwesomeComponent;
}
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import { SecondComponent } from './second/second.component';
import { FirstComponent } from './first/first.component';
import { AppRoutingModule } from './app.routing.module';
import { NgHttpLoaderModule } from 'ng-http-loader';
import { UploadComponent } from './upload/upload.component';
import { HttpService } from './http.service';
import { UploadService } from './upload/upload.service';
import { HttpClientModule, HttpClientXsrfModule } from '@angular/common/http';
import { AwesomeComponent } from 'my.awesome.component';
@NgModule({
declarations: [
AppComponent,
FirstComponent,
SecondComponent,
UploadComponent,
],
imports: [
BrowserModule,
FormsModule,
HttpClientModule,
HttpClientXsrfModule,
AppRoutingModule,
NgHttpLoaderModule.forRoot(),
],
providers: [
HttpService,
UploadService,
],
bootstrap: [AppComponent]
})
export class AppModule {
}
@xts-velkumars
Copy link

Good day,
I'm trying to implement my own custom spinner.
Could you please share me 'my.awesome.component' file. it would be real appreciated

@mpalourdio
Copy link
Author

That's just an example. It represents your own spinner component you want to integrate.

@bonjourclaudio
Copy link

"ng: Can't bind to 'entryComponent' since it isn't a known property of 'spinner'"

@mpalourdio
Copy link
Author

@hackherlin I have update the gists, if your are using ng-http-loader v3, the <spinner> component selector has been replaced by <ng-http-loader>

@DaruoMatrix
Copy link

thank you, can you made a simple example of AwesomeComponent ?

@mpalourdio
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment