How to create a spinner in angular

后端 未结 2 1366
无人及你
无人及你 2020-12-20 03:07

I have a requirement How to create a spinner common component with a spinner service(costume service) file for angular 5. that once I click on button and drop down also , sp

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-20 03:34

    This is kind of an easy and ready made solution. Download font awesome CSS icon pack from here:

    https://fontawesome.com/v4.7.0/get-started

    Then include the 'font-awesome.min.css' file from the css folder within the head tags of your "index.html":

      
    

    Create a spinner component that you can resize and reuse everywhere:

    spinner.component.ts:

    import { Component, Input } from '@angular/core';
    @Component
    ({
        selector    :  'spinner',
        templateUrl :  './spinner.component.html'
    })
    
    export class spinnerComponent 
    {
        @Input () spinnerSize; 
    } 
    

    spinner.component.html:

    In any template where you would wish to use the spinner just include the following:

    
    

提交回复
热议问题