2.0.1 • Published 3 years ago
rj-spinner v2.0.1
RjSpinner
This library was generated with https://github.com/angular/angular-cli version 9.1.13.
Installation
rj-spinner
is available via npm and yarn
Using npm:
$ npm install rj-spinner --save
Using yarn:
$ yarn add rj-spinner
Using angular-cli:
$ ng add rj-spinner
Usage
Import RjSpinnerModule
in in the root module(AppModule
):
import { RjSpinnerModule } from 'rj-spinner';
@NgModule({
imports: [
RjSpinnerModule,
],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
Add RjSpinnerService
service wherever you want to use the rj-spinner
.
import { RjSpinnerService } from 'rj-spinner';
class AppComponent implements OnInit {
constructor(private spinner: RjSpinnerService) {}
ngOnInit() {
/** spinner starts on init */
this.spinner.show();
setTimeout(() => {
/** spinner ends after 5 seconds */
this.spinner.hide();
}, 5000);
}
}
Now use in your template
<rj-spinner ></rj-spinner>
See Demo
Methods
RjSpinnerService.show()
Shows the spinnerRjSpinnerService.hide()
Hides the spinner