0.0.15 • Published 6 years ago
fe-modal v0.0.15
F.E.Mock fe-modal
Dependencies
- Angular >=4.0.0
Install
You can get it on npm.
npm install fe-modal --save
Usage
.angular-cli.json
"apps": [
{
...
"styles": [
"../node_modules/fe-modal/modal.less"
],
...
}
]
app.module.ts:
import { ModalModule } from 'fe-modal';
@NgModule({
declarations: [
AppComponent
],
imports: [
...
ModalModule.forRoot(),
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}
Use in components:
import { ModalService } from 'fe-modal';
@Component({
selector: 'app-demo',
templateUrl: './app-demo.component.html',
styleUrls: ['./app-demo.component.less']
})
export class DemoComponent {
constructor (private modal: ModalService) {}
dialog () {
this.modal.dialog({ template: FormComponent });
}
alert () {
this.modal.alert({ template: 'alert' });
}
loading () {
this.modal.loading({ template: 'loading' });
}
remove (id: string) {
this.modal.confirm({
template: 'Do not restore after deletion, please operate carefully',
confirmCallback: () => {
// code ...
}
});
}
}