diff --git a/README.md b/README.md index a1f6773..eae8421 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# ng2-toasty [![Build Status](https://travis-ci.org/akserg/ng2-toasty.svg?branch=master)](https://travis-ci.org/akserg/ng2-toasty) [![npm version](https://img.shields.io/npm/v/ng2-toasty.svg)](https://www.npmjs.com/package/ng2-toasty) [![npm monthly downloads](https://img.shields.io/npm/dm/ng2-toasty.svg?style=flat-square)](https://www.npmjs.com/package/ng2-toasty)[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) +# ng2-slim-loading-bar [![Build Status](https://travis-ci.org/akserg/ng2-slim-loading-bar.svg?branch=master)](https://travis-ci.org/akserg/ng2-slim-loading-bar) [![npm version](https://img.shields.io/npm/v/ng2-slim-loading-bar.svg)](https://www.npmjs.com/package/ng2-slim-loading-bar) [![npm monthly downloads](https://img.shields.io/npm/dm/ng2-slim-loading-bar.svg?style=flat-square)](https://www.npmjs.com/package/ng2-slim-loading-bar)[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) -Angular2 Toasty component shows growl-style alerts and messages for your application. +Angular2 component shows slim loading bar at the top of the page of your application. -Simple examples using ng2-toasty: +Simple examples using ng2-slim-loading-bar: - with SystemJS in [ng2-systemjs-demo](https://github.com/akserg/ng2-systemjs-demo) - with Webpack in [ng2-webpack-demo](https://github.com/akserg/ng2-webpack-demo) @@ -11,146 +11,51 @@ Online demo available [here](http://akserg.github.io/ng2-webpack-demo) ## Installation First you need to install the npm module: ```sh -npm install ng2-toasty --save +npm install ng2-slim-loading-bar --save ``` If you use SystemJS to load your files, you might have to update your config with this if you don't use `defaultJSExtensions: true`: ```js System.config({ packages: { - "/ng2-toasty": {"defaultExtension": "js"} + "/ng2-slim-loading-bar": {"defaultExtension": "js"} } }); ``` -Finally, you can use *ng2-toasty* in your Angular 2 project: -- Import `ToastyService, ToastyConfig, Toasty, ToastOptions` from `ng2-toasty/ng2-toasty` -- Instantiate `ToastyService, ToastyConfig` in the bootstrap of your application; -- Add `Toasty` to the "directives" property of your application component; -- Add `` tag in template of your application component. +Finally, you can use *ng2-slim-loading-bar* in your Angular 2 project: +- Import `SlimLoadingBarService, SlimLoadingBar` from `ng2-slim-loading-bar/ng2-slim-loading-bar` +- Instantiate `SlimLoadingBarService` in the bootstrap of your application; +- Add `SlimLoadingBar` to the "directives" property of your application component; +- Add `` tag in template of your application component. ```js import {Component} from 'angular2/core'; -import {ToastyService, ToastyConfig, Toasty, ToastOptions, ToastData} from 'ng2-toasty/ng2-toasty'; +import {SlimLoadingBarService, SlimLoadingBar} from 'ng2-slim-loading-bar/ng2-slim-loading-bar'; import {bootstrap} from 'angular2/platform/browser'; bootstrap(AppComponent, [ - ToastyService, ToastyConfig // It is required to have 1 unique instance of your service + SlimLoadingBarService // It is required to have 1 unique instance of your service ]); @Component({ selector: 'app', - directives: [Toasty], + directives: [SlimLoadingBar], template: `
Hello world
- - + + ` }) export class AppComponent { - constructor(private toastyService:ToastyService) { } + constructor(private slimLoadingBarService:SlimLoadingBarService) { } - addToast() { - // Just add default Toast with title only - this.toastyService.default('Hi there'); - // Or create the instance of ToastOptions - var toastOptions:ToastOptions = { - title: "My title", - msg: "The message", - showClose: true, - timeout: 5000, - theme: 'default' - onAdd: (toast:ToastData) => { - console.log('Toast ' + toast.id + ' has been added!'); - }, - onRemove: function(toast:ToastData) { - console.log('Toast ' + toast.id + ' has been removed!'); - } - }; - // Add see all possible types in one shot - this.toastyService.info(toastOptions); - this.toastyService.success(toastOptions); - this.toastyService.wait(toastOptions); - this.toastyService.error(toastOptions); - this.toastyService.warning(toastOptions); - } -} -``` - -## How dynamically update title and message of toast -Here is an example of how to dynamically update message and title of individual toast: - -```js -import {Component} from 'angular2/core'; -import {ToastyService, ToastyConfig, Toasty, ToastOptions, ToastData} from 'ng2-toasty/ng2-toasty'; -import {bootstrap} from 'angular2/platform/browser'; -import {Subject, Observable, Subscription} from 'rxjs/Rx'; - -bootstrap(AppComponent, [ - ToastyService, ToastyConfig // It is required to have 1 unique instance of your service -]); - -@Component({ - selector: 'app', - directives: [Toasty], - template: ` -
Hello world
- - - ` -}) -export class AppComponent { - - getTitle(num: number): string { - return 'Countdown: ' + num; - } - - getMessage(num: number): string { - return 'Seconds left: ' + num; - } - - constructor(private toastyService:ToastyService) { } - - addToast() { - let interval = 1000; - let timeout = 5000; - let seconds = timeout / 1000; - let subscription: Subscription; - - let toastOptions: ToastOptions = { - title: this.getTitle(seconds), - msg: this.getMessage(seconds), - showClose: true, - timeout: timeout, - onAdd: (toast: ToastData) => { - console.log('Toast ' + toast.id + ' has been added!'); - // Run the timer with 1 second iterval - let observable = Observable.interval(interval).take(seconds); - // Start listen seconds beat - subscription = observable.subscribe((count: number) => { - // Update title of toast - toast.title = this.getTitle(seconds - count - 1); - // Update message of toast - toast.msg = this.getMessage(seconds - count - 1); - }); - - }, - onRemove: function(toast: ToastData) { - console.log('Toast ' + toast.id + ' has been removed!'); - // Stop listenning - subscription.unsubscribe(); - } - }; - - switch (this.options.type) { - case 'default': this.toastyService.default(toastOptions); break; - case 'info': this.toastyService.info(toastOptions); break; - case 'success': this.toastyService.success(toastOptions); break; - case 'wait': this.toastyService.wait(toastOptions); break; - case 'error': this.toastyService.error(toastOptions); break; - case 'warning': this.toastyService.warning(toastOptions); break; - } + startLoading() { + // We can listen when loading will be completed + this.slimLoadingBarService.start(() => { + console.log('Loading complete'); + }); } } ``` @@ -159,4 +64,4 @@ export class AppComponent { [MIT](/LICENSE) # Credits -Inspired by [angular-toasty](https://github.com/teamfa/angular-toasty) +Inspired by [ngProgress.js](https://github.com/VictorBjelkholm/ngProgress) diff --git a/bundles/ng2-slim-loading-bar.js b/bundles/ng2-slim-loading-bar.js new file mode 100644 index 0000000..10d8b1b --- /dev/null +++ b/bundles/ng2-slim-loading-bar.js @@ -0,0 +1,253 @@ +System.registerDynamic("src/component", ["angular2/core", "angular2/common", "./service"], true, function($__require, exports, module) { + ; + var define, + global = this, + GLOBAL = this; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + var c = arguments.length, + r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, + d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + r = Reflect.decorate(decorators, target, key, desc); + else + for (var i = decorators.length - 1; i >= 0; i--) + if (d = decorators[i]) + r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var core_1 = $__require('angular2/core'); + var common_1 = $__require('angular2/common'); + var service_1 = $__require('./service'); + var SlimLoadingBar = (function() { + function SlimLoadingBar(service) { + this.service = service; + this._progress = '0%'; + this.color = 'firebrick'; + this.height = '2px'; + this.show = true; + } + Object.defineProperty(SlimLoadingBar.prototype, "progress", { + get: function() { + return this._progress; + }, + set: function(value) { + if (value) { + this._progress = value + '%'; + } + }, + enumerable: true, + configurable: true + }); + SlimLoadingBar.prototype.ngOnInit = function() { + var _this = this; + this.service.observable.subscribe(function(event) { + if (event.type === service_1.SlimLoadingBarEventType.PROGRESS) { + _this.progress = event.value; + } else if (event.type === service_1.SlimLoadingBarEventType.COLOR) { + _this.color = event.value; + } else if (event.type === service_1.SlimLoadingBarEventType.HEIGHT) { + _this.height = event.value; + } else if (event.type === service_1.SlimLoadingBarEventType.VISIBLE) { + _this.show = event.value; + } + }); + }; + __decorate([core_1.Input(), __metadata('design:type', String), __metadata('design:paramtypes', [String])], SlimLoadingBar.prototype, "progress", null); + __decorate([core_1.Input(), __metadata('design:type', String)], SlimLoadingBar.prototype, "color", void 0); + __decorate([core_1.Input(), __metadata('design:type', String)], SlimLoadingBar.prototype, "height", void 0); + __decorate([core_1.Input(), __metadata('design:type', Boolean)], SlimLoadingBar.prototype, "show", void 0); + SlimLoadingBar = __decorate([core_1.Component({ + selector: 'ng2-slim-loading-bar', + directives: [common_1.CORE_DIRECTIVES], + template: "\n
\n
\n
" + }), __metadata('design:paramtypes', [service_1.SlimLoadingBarService])], SlimLoadingBar); + return SlimLoadingBar; + })(); + exports.SlimLoadingBar = SlimLoadingBar; + return module.exports; +}); + +System.registerDynamic("src/service", ["angular2/core", "angular2/src/facade/lang", "rxjs/Observable"], true, function($__require, exports, module) { + ; + var define, + global = this, + GLOBAL = this; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + var c = arguments.length, + r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, + d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + r = Reflect.decorate(decorators, target, key, desc); + else + for (var i = decorators.length - 1; i >= 0; i--) + if (d = decorators[i]) + r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var core_1 = $__require('angular2/core'); + var lang_1 = $__require('angular2/src/facade/lang'); + var Observable_1 = $__require('rxjs/Observable'); + (function(SlimLoadingBarEventType) { + SlimLoadingBarEventType[SlimLoadingBarEventType["PROGRESS"] = 0] = "PROGRESS"; + SlimLoadingBarEventType[SlimLoadingBarEventType["HEIGHT"] = 1] = "HEIGHT"; + SlimLoadingBarEventType[SlimLoadingBarEventType["COLOR"] = 2] = "COLOR"; + SlimLoadingBarEventType[SlimLoadingBarEventType["VISIBLE"] = 3] = "VISIBLE"; + })(exports.SlimLoadingBarEventType || (exports.SlimLoadingBarEventType = {})); + var SlimLoadingBarEventType = exports.SlimLoadingBarEventType; + var SlimLoadingBarEvent = (function() { + function SlimLoadingBarEvent(type, value) { + this.type = type; + this.value = value; + } + return SlimLoadingBarEvent; + })(); + exports.SlimLoadingBarEvent = SlimLoadingBarEvent; + var SlimLoadingBarService = (function() { + function SlimLoadingBarService() { + var _this = this; + this._progress = 0; + this._height = '2px'; + this._color = 'firebrick'; + this._visible = true; + this.intervalCounterId = 0; + this.interval = 500; + this.isPaused = false; + this.observable = new Observable_1.Observable(function(subscriber) { + _this.subscriber = subscriber; + }); + } + Object.defineProperty(SlimLoadingBarService.prototype, "progress", { + get: function() { + return this._progress; + }, + set: function(value) { + if (lang_1.isPresent(value)) { + this._progress = value; + this.emitEvent(new SlimLoadingBarEvent(SlimLoadingBarEventType.PROGRESS, this._progress)); + } + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SlimLoadingBarService.prototype, "height", { + get: function() { + return this._height; + }, + set: function(value) { + if (lang_1.isPresent(value)) { + this._height = value; + this.emitEvent(new SlimLoadingBarEvent(SlimLoadingBarEventType.HEIGHT, this._height)); + } + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SlimLoadingBarService.prototype, "color", { + get: function() { + return this._color; + }, + set: function(value) { + if (lang_1.isPresent(value)) { + this._color = value; + this.emitEvent(new SlimLoadingBarEvent(SlimLoadingBarEventType.COLOR, this._color)); + } + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SlimLoadingBarService.prototype, "visible", { + get: function() { + return this._visible; + }, + set: function(value) { + if (lang_1.isPresent(value)) { + this._visible = value; + this.emitEvent(new SlimLoadingBarEvent(SlimLoadingBarEventType.VISIBLE, this._visible)); + } + }, + enumerable: true, + configurable: true + }); + SlimLoadingBarService.prototype.emitEvent = function(event) { + try { + this.subscriber.next(event); + } catch (e) { + console.log(e); + console.log('!!! Suggestion: Seems you forget add into your html?'); + } + }; + SlimLoadingBarService.prototype.start = function(onCompleted) { + var _this = this; + if (onCompleted === void 0) { + onCompleted = null; + } + if (this.intervalCounterId) { + this.stop(); + } + this._onCompleted = onCompleted; + this.intervalCounterId = setInterval(function() { + if (!_this.isPaused) { + _this.progress++; + if (_this.progress === 100) { + _this.complete(); + } + } + }, this.interval); + }; + SlimLoadingBarService.prototype.pause = function() { + this.isPaused = !this.isPaused; + }; + SlimLoadingBarService.prototype.stop = function() { + if (this.intervalCounterId) { + clearInterval(this.intervalCounterId); + this.intervalCounterId = null; + } + }; + SlimLoadingBarService.prototype.reset = function() { + this.stop(); + this.progress = 0; + }; + SlimLoadingBarService.prototype.complete = function() { + this.progress = 100; + if (this._onCompleted) { + this._onCompleted.call(this); + } + this.stop(); + }; + SlimLoadingBarService = __decorate([core_1.Injectable(), __metadata('design:paramtypes', [])], SlimLoadingBarService); + return SlimLoadingBarService; + })(); + exports.SlimLoadingBarService = SlimLoadingBarService; + return module.exports; +}); + +System.registerDynamic("ng2-slim-loading-bar", ["./src/component", "./src/service"], true, function($__require, exports, module) { + "use strict"; + ; + var define, + global = this, + GLOBAL = this; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + var component_1 = $__require('./src/component'); + var service_1 = $__require('./src/service'); + __export($__require('./src/component')); + __export($__require('./src/service')); + Object.defineProperty(exports, "__esModule", {value: true}); + exports.default = { + providers: [service_1.SlimLoadingBarService], + directives: [component_1.SlimLoadingBar] + }; + return module.exports; +}); diff --git a/bundles/ng2-slim-loading-bar.min.js b/bundles/ng2-slim-loading-bar.min.js new file mode 100644 index 0000000..34ebe3b --- /dev/null +++ b/bundles/ng2-slim-loading-bar.min.js @@ -0,0 +1,2 @@ +System.registerDynamic("src/component",["angular2/core","angular2/common","./service"],!0,function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=3>o?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(3>o?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},o=e("angular2/core"),s=e("angular2/common"),a=e("./service"),c=function(){function e(e){this.service=e,this._progress="0%",this.color="firebrick",this.height="2px",this.show=!0}return Object.defineProperty(e.prototype,"progress",{get:function(){return this._progress},set:function(e){e&&(this._progress=e+"%")},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var e=this;this.service.observable.subscribe(function(t){t.type===a.SlimLoadingBarEventType.PROGRESS?e.progress=t.value:t.type===a.SlimLoadingBarEventType.COLOR?e.color=t.value:t.type===a.SlimLoadingBarEventType.HEIGHT?e.height=t.value:t.type===a.SlimLoadingBarEventType.VISIBLE&&(e.show=t.value)})},i([o.Input(),n("design:type",String),n("design:paramtypes",[String])],e.prototype,"progress",null),i([o.Input(),n("design:type",String)],e.prototype,"color",void 0),i([o.Input(),n("design:type",String)],e.prototype,"height",void 0),i([o.Input(),n("design:type",Boolean)],e.prototype,"show",void 0),e=i([o.Component({selector:"ng2-slim-loading-bar",directives:[s.CORE_DIRECTIVES],template:'\n
\n
\n
'}),n("design:paramtypes",[a.SlimLoadingBarService])],e)}();return t.SlimLoadingBar=c,r.exports}),System.registerDynamic("src/service",["angular2/core","angular2/src/facade/lang","rxjs/Observable"],!0,function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=3>o?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(3>o?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},n=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},o=e("angular2/core"),s=e("angular2/src/facade/lang"),a=e("rxjs/Observable");!function(e){e[e.PROGRESS=0]="PROGRESS",e[e.HEIGHT=1]="HEIGHT",e[e.COLOR=2]="COLOR",e[e.VISIBLE=3]="VISIBLE"}(t.SlimLoadingBarEventType||(t.SlimLoadingBarEventType={}));var c=t.SlimLoadingBarEventType,l=function(){function e(e,t){this.type=e,this.value=t}return e}();t.SlimLoadingBarEvent=l;var p=function(){function e(){var e=this;this._progress=0,this._height="2px",this._color="firebrick",this._visible=!0,this.intervalCounterId=0,this.interval=500,this.isPaused=!1,this.observable=new a.Observable(function(t){e.subscriber=t})}return Object.defineProperty(e.prototype,"progress",{get:function(){return this._progress},set:function(e){s.isPresent(e)&&(this._progress=e,this.emitEvent(new l(c.PROGRESS,this._progress)))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(e){s.isPresent(e)&&(this._height=e,this.emitEvent(new l(c.HEIGHT,this._height)))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"color",{get:function(){return this._color},set:function(e){s.isPresent(e)&&(this._color=e,this.emitEvent(new l(c.COLOR,this._color)))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"visible",{get:function(){return this._visible},set:function(e){s.isPresent(e)&&(this._visible=e,this.emitEvent(new l(c.VISIBLE,this._visible)))},enumerable:!0,configurable:!0}),e.prototype.emitEvent=function(e){try{this.subscriber.next(e)}catch(t){console.log(t),console.log("!!! Suggestion: Seems you forget add into your html?")}},e.prototype.start=function(e){var t=this;void 0===e&&(e=null),this.intervalCounterId&&this.stop(),this._onCompleted=e,this.intervalCounterId=setInterval(function(){t.isPaused||(t.progress++,100===t.progress&&t.complete())},this.interval)},e.prototype.pause=function(){this.isPaused=!this.isPaused},e.prototype.stop=function(){this.intervalCounterId&&(clearInterval(this.intervalCounterId),this.intervalCounterId=null)},e.prototype.reset=function(){this.stop(),this.progress=0},e.prototype.complete=function(){this.progress=100,this._onCompleted&&this._onCompleted.call(this),this.stop()},e=i([o.Injectable(),n("design:paramtypes",[])],e)}();return t.SlimLoadingBarService=p,r.exports}),System.registerDynamic("ng2-slim-loading-bar",["./src/component","./src/service"],!0,function(e,t,r){"use strict";function i(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}var n=e("./src/component"),o=e("./src/service");return i(e("./src/component")),i(e("./src/service")),Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={providers:[o.SlimLoadingBarService],directives:[n.SlimLoadingBar]},r.exports}); +//# sourceMappingURL=bundles/ng2-slim-loading-bar.min.js.map \ No newline at end of file diff --git a/ng2-slim-loading-bar.css b/ng2-slim-loading-bar.css index 171706e..e6f22b2 100644 --- a/ng2-slim-loading-bar.css +++ b/ng2-slim-loading-bar.css @@ -4,8 +4,20 @@ * https://github.com/akserg/ng2-slim-loading-bar */ -/* Styling for the ngProgress itself */ -#ngProgress { + +/* Styling for the Slim Loading Progress Bar container */ +.slim-loading-bar { + position: fixed; + margin: 0; + padding: 0; + top: 0; + left: 0; + right: 0; + z-index: 99999; +} + +/* Styling for the Slim Loading Progress Bar itself */ +.slim-loading-bar-progress { margin: 0; padding: 0; z-index: 99998; @@ -21,14 +33,3 @@ -o-transition: all 0.5s ease-in-out; transition: all 0.5s ease-in-out; } - -/* Styling for the ngProgress-container */ -#ngProgress-container { - position: fixed; - margin: 0; - padding: 0; - top: 0; - left: 0; - right: 0; - z-index: 99999; -} diff --git a/ng2-slim-loading-bar.ts b/ng2-slim-loading-bar.ts index 1578d40..c8f6970 100644 --- a/ng2-slim-loading-bar.ts +++ b/ng2-slim-loading-bar.ts @@ -4,7 +4,7 @@ 'use strict'; -import {SlimLoadingBarComponent} from './src/component'; +import {SlimLoadingBar} from './src/component'; import {SlimLoadingBarService} from './src/service'; export * from './src/component'; @@ -12,5 +12,5 @@ export * from './src/service'; export default { providers: [SlimLoadingBarService], - directives: [SlimLoadingBarComponent] + directives: [SlimLoadingBar] } diff --git a/package.json b/package.json index db53cd3..d30c2e0 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,8 @@ "keywords": [ "angular", "angular2", - "slim", - "loading", + "slim", + "loading", "bar", "progress" ], @@ -55,4 +55,4 @@ "path": "./node_modules/cz-conventional-changelog" } } -} \ No newline at end of file +} diff --git a/src/component.ts b/src/component.ts index 786e70f..7dc79f0 100644 --- a/src/component.ts +++ b/src/component.ts @@ -19,7 +19,7 @@ import {SlimLoadingBarService, SlimLoadingBarEvent, SlimLoadingBarEventType} fro [style.height]="height" [style.opacity]="show ? '1' : '0'"> ` }) -export class SlimLoadingBarComponent implements OnInit { +export class SlimLoadingBar implements OnInit { private progressEl:HTMLDivElement; diff --git a/tests/component.spec.ts b/tests/component.spec.ts index 9fbb7e6..ae6b41e 100644 --- a/tests/component.spec.ts +++ b/tests/component.spec.ts @@ -18,13 +18,13 @@ from 'angular2/platform/testing/browser'; import {Observable} from 'rxjs/Observable'; import {SlimLoadingBarService, SlimLoadingBarEvent, SlimLoadingBarEventType} from '../src/service'; -import {SlimLoadingBarComponent} from '../src/component'; +import {SlimLoadingBar} from '../src/component'; export function main() { - describe('SlimLoadingBarComponent', () => { + describe('SlimLoadingBar', () => { let componentFixture:ComponentFixture; - let component:SlimLoadingBarComponent; + let component:SlimLoadingBar; let containerDiv:HTMLDivElement; let progressDiv:HTMLDivElement; @@ -33,7 +33,7 @@ export function main() { }); beforeEach(injectAsync([TestComponentBuilder], (tcb:TestComponentBuilder) => { - return tcb.createAsync(SlimLoadingBarComponent).then((cf:ComponentFixture) => { + return tcb.createAsync(SlimLoadingBar).then((cf:ComponentFixture) => { componentFixture = cf; let element = componentFixture.nativeElement; containerDiv = element.querySelector('.slim-loading-bar');