Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular2 Material2 <md-spinner> not showing but is working

My assumption is that my css is not correct, but alas I cannot figure this out.

<div *ngIf="loading">
  <md-progress-circle mode="indeterminate" color="warn">Loading...</md-progress-circle>
</div>
<md-list>
  <md-list-item *ngFor="let incident of incidents">
    <h3 md-line> {{name}} </h3>
    <p md-line>
      <span>{{date}} > </span>
      <span>{{text}}</span>
    </p>
  </md-list-item>
</md-list>

enter image description here

like image 568
bdparrish Avatar asked Jan 11 '17 03:01

bdparrish


People also ask

How do you use the mat progress spinner?

To use spinners we need to simply use <mat-spinner> tag. They are two types of progress bars like determinate and indeterminate. Indeterminate the spinner will not rotate but in the case of indeterminate, the spinner rotates continuously. For determinate type spinners, we need to give value in order to display them.


1 Answers

You need to make sure you're using a theme for @angular/material.

From the getting started guide:

Include the core and theme styles:

This is required to apply all of the core and theme styles to your application. You can either use a pre-built theme, or define your own custom theme.

  • See the theming guide for instructions.

I've found using @angular/material without a theme to work only some of the time. Text inputs work but radiobuttons, checkboxes - and it appears the spinners - require a theme to work properly.

As noted in the quote, you can either use one of the provided themes (there's currently 6 provided) or create your own. The provided themes can be included in your css using @import('~@angular/material/core/theming/prebuilt/<theme>.css').

like image 104
Micheal Hill Avatar answered Sep 28 '22 12:09

Micheal Hill