Skip to content

Instantly share code, notes, and snippets.

@LucasJorgeHubert
Created December 12, 2018 18:54
Show Gist options
  • Save LucasJorgeHubert/b5ab31a9070532fdf4309a1698427ee0 to your computer and use it in GitHub Desktop.
Save LucasJorgeHubert/b5ab31a9070532fdf4309a1698427ee0 to your computer and use it in GitHub Desktop.
Loading Angular
import { NgxLoadingModule, ngxLoadingAnimationTypes } from 'ngx-loading';
NgxLoadingModule.forRoot({
animationType: ngxLoadingAnimationTypes.pulse, // Aqui voce decide o estilo do loading ([ctrl]+[space])
backdropBackgroundColour: 'rgba(0,0,0,0.1)',
backdropBorderRadius: '4px',
primaryColour: '#008e57',
secondaryColour: '#008e57',
tertiaryColour: '#008e57'
})
<ngx-loading [show]="loading" [config]="{ backdropBorderRadius: '3px' }" [template]="customLoadingTemplate"></ngx-loading>
export class indexComponent {
// Inicia o Loading como falso
public loading = false;
// Função para chamada da API setando o Loading como
// true antes de iniciar a request, e setando
// como falso assim que recebe a resposta
searchPerDate() {
this.loading = true;
this.indexeService.indexFunction(
).subscribe(list => (this.indexList = list, this.loading = false))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment