Based on Angular2-Skeleton - complete Angular4 build enviroment using Angular4 frmework, SystemJS module loader, gulp build system, browser-sync and node expressjs backend server.
FlashBox(ng2-flashbox) - angular2 component used to display simple user information messages.
FlashBox(ng2-flashbox) GitHub repo.
FlashBox(ng2-flashbox) development enviroment(Angular4, SystemJS, gulp) repo.
Try online-demo.
Download from npm.
Must have node, npm and gulp installed
Install node dependencies in your project root directory (this is where the 'package.json' file is located) using:
$ npm install
Start application with
$ gulp
Wait untill application is fully compiled and backend server is started (notified by message).
Navigate to
http://localhost:3000/index.html
to start application. If everything is ok Angular4-FlashBoxComponent sample application will start.
You can now user FlashBox component with <flash-box>
element in app.component.html or define FlashBoxComponent component in the controller.
From ng2-flashbox README.md:
Place your HTML based user information message inside element.
<flash-box>
<!-- HTML Message -->
<div style="border-type: solid; border-width:2px">
<label style="color: rgb(0,0,0); text-decoration: underline;">Information message</label>
<label>
Any message
</label>
</div>
</flash-box>
<flash-box type="typeValue" position="positionValue" max-width="maxWidthValue" setTimeout="setTimeoutValue">
<!-- HTML message -->
</flash-box>
- typeValue: string, default: primary.
Specify FlashBox type. Available values(bootstrap label types): default, primary, success, info, warning, danger.
- positionValue: string, default: tr.
Specify FlashBox position. Available values:
- tr - top-right,
- tm - top-middle,
- tl - top-left,
- cr - center-right,
- cm - center-middle,
- cl - center-left,
- br - bottom-right,
- bm - bottom-middle,
- bl - bottom-left
- maxWidthValue: string, default: 300px
Specify FlashBox maximum width.
- setTimeoutValue: number, default: 2000
Specify the amount of time FlashBox is visible in ms.
Use angular2 template local variable(TLV) system or invoke a method from a controller.
<flash-box .... #tlv_name>
....
</flash-box>
<button (click)="tlv_name.available_action()">Cause flashbox action</button>
reference component source
import { FlashBoxComponent } from 'ng2-flashbox';
reference component from template local variable using
@ViewChild("tlv_name") tlv:FlashBoxComponent;
tlv.available_action();
- flashOnce():void - show FlashBox once for setTimeout time.
- show():void - show FlashBox.
- hide():void - hide FlashBox.
- startFlashing():void - start flashing. Transition period between unvisible and visible is set to 0,5 sec and is currently unconfigurable. The FlashBox control is shown for setTimeout time.
- stopFlashing():void - stop flashing.
- toogle():void - toggle show/hide control.
- flashTimes(number numOfTimes):void - show FlashBox numOfTimes times.
- version():string - to return the current version of the control
- busyEvent() - fires when FlashBox is busy. When show() on FlashBox that is already shown. When hide() on FlashBox that is already hidden. When flashOnce() on FlashBox that is already shown or blinking. When startFlashing() on FlashBox that is already shown or blinking. When flashTimes(number numOfTImes) on FlashBox that is alread shown or blinking.
- onStartVisibleEvent() - fires when FlashBox is starting to show.
- onEndVisibleEvent() - fires when FlashBox is completely shown.
- onStartHiddenEvent() - fires when FlashBox is starting to become unvisible.
- onEndHiddenEvent() - fires when FlashBox is completely invisible.
- invalidValueEvent() - fires when setTimeout to number that is less or equal 0.
- onTypeChangedEvent - fires when you change type property of the control.
- onPositionChangedEvent - fires when you change position property of the control.
- onMaxWidthChangedEvent - fires when you change maxwidth property of the control.
- onTimeoutChangedEvent - fires when you change setTimeout property of the control.