项目作者: slavede

项目描述 :
Angular (typescript) Spinner. Wrapper around spinner: http://spin.js.org/
高级语言: TypeScript
项目地址: git://github.com/slavede/ng-ts-spinner.git
创建时间: 2017-07-27T10:21:42Z
项目社区:https://github.com/slavede/ng-ts-spinner

开源协议:

下载


NgTsSpinner

Angular (typescript) Spinner. Wrapper around spinner: http://spin.js.org/ (<3.0.0 version).

Installation

It has dependency on spin.js. It doesn’t include it in bundle so you have to isntall it yourself (<3.0.0 until #3 is fixed).

  1. npm install spin.js@2.x --save
  2. npm install ng-ts-spinner --save

Angular CLI

In case you are using Angular CLI, add spin.js (it will be downloaded together with ng-ts-spinner module) to your scripts path:

"scripts": ["../node_modules/spin.js/spin.min.js"]

Usage

Import module

  1. import { NgTsSpinnerModule } from 'ng-ts-spinner';
  2. . . .
  3. @NgModule({
  4. . . .
  5. imports : [
  6. . . .
  7. NgTsSpinnerModule
  8. ]

Use component

  1. <div ng-ts-spinner [spinOn]="loadingInProgress" [options]="spinnerOptions">
  2. <div>Everything here will be under the spinner</div>
  3. </div>

Properties

spinOn - when set to true, spinner spins, when false, spinner is removed

overlayWhileSpin - if true, it will display overlay, making everything non-clickable where it is spinning (make sure parent element has positioning set)

spinnerOptions - options based on options from http://spin.js.org/. It can be empty, it will use defaults

When changing spinnerOptions, spinner should be stopped, and then again spin to apply changes of the options.

Release notes

1.7.0

Breaking change: Added support for Angular6+. Now only support Angular6+, for below version, use 1.6.x

1.6.0
  • New way of installing dependency. Spin.js has to be installed manually (since npm3+ doesn’t install dependency automatically).
1.5.0

BREAKING CHANGE: Change the way you import module to:

  1. import { NgTsSpinnerModule } from 'ng-ts-spinner';
1.3.0
  • Added support for overlayWhileSpin
  • Added index.ts to have nicer import (only name of the module)
1.2.0
  • Restricted spin.js dependency to be under 3.0.0 because 3.0.0 removed spin.min.js.
1.0.1
  • Spinner doesn’t add extra div to the placeholder