0.0.7 • Published 7 years ago

ng2-simplert v0.0.7

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

ng2-simplert

Angular 2 Simple Alert Component (SweetAlert Inspired) We use icon from SweetAlert

Ng2-Simplert

Demo

https://mazipan.github.io/ng2-simplert/

Download

npm install ng2-simplert --save
-- OR --
yarn add ng2-simplert

Or download latest release here : https://github.com/mazipan/ng2-simplert/releases

Module Declaration

....
import { SimplertComponent } from './simplert.component';
import { SimplertService } from './simplert.component.service';
...
@NgModule({
  declarations: [
    ...
    SimplertComponent
  ],
  imports: [
    ...
  ],
  providers: [
    SimplertService
  ]
})

See here : https://github.com/mazipan/ng2-simplert/blob/master/src/app/app.module.ts

Usage in component

....
import { SimplertService } from './simplert.component.service';
...
@Component({
  selector: 'app-root',
  template: `
    <button class="open--info" (click)="showPopup('Information!', 'Hey, I am Opened...')">Open Information Alert</button>
    <SimplertComponent [isUseRadius]="true"></SimplertComponent>
  `
})
export class AppComponent {

  constructor(private _simplertService: SimplertService){}

  showPopup(title: string, message: string){
    this._simplertService.openPopupBlock(title, message);
  }
}

See here : https://github.com/mazipan/ng2-simplert/blob/master/src/app/app.component.ts

Exposed Attribute

You can add this attribute below in :

AttributeParameterDescription
isUseRadiusbooleanParam: booleantrue : will use radius, false : not use radius
isUseIconbooleanParam: booleantrue : will use icon, false : not use icon

Exposed Method

You can access this below method from SimplertService :

Method NameParameterDescription
openPopupBlocktitle: stringTitle of alert (can be empty)
message: stringMessage of alert (can be HTML syntax)
openPopupBlockWithTypetitle: stringTitle of alert (can be empty)
message: stringMessage of alert (can be HTML syntax)
type: stringinfo (default), success, warning, error
changeShownbooleanParam: booleantrue : show, false : hide
setTitletitle: stringTitle of alert (can be empty)
setMessagemessage: stringMessage of alert (can be HTML syntax)
setTypetype: stringinfo (default), success, warning, error
setColorBtnbtnColor: stringstring hex color (default: #068AC9)

License

MIT License

Hope will usefull for you all. Question ? please email : mazipanneh@gmail.com