Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sheikalthaf/ngu-modal
It is a angular modal similar to bootstrap modal
https://github.com/sheikalthaf/ngu-modal
angular-modal modal
Last synced: about 7 hours ago
JSON representation
It is a angular modal similar to bootstrap modal
- Host: GitHub
- URL: https://github.com/sheikalthaf/ngu-modal
- Owner: sheikalthaf
- Created: 2017-10-07T10:25:14.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T08:22:47.000Z (about 1 year ago)
- Last Synced: 2024-11-17T16:22:20.452Z (about 2 months ago)
- Topics: angular-modal, modal
- Language: TypeScript
- Size: 130 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ngu-modal
It is a angular modal similar to bootstrap modal
## Installation
`npm i @ngu/modal --save`
## sample
include `NguModalModule` in your module
```javascript
import { NguModalModule } from '@ngu/modal';@NgModule({
imports: [
NguModalModule
],
})
export class AppModule { }
```Then use in your component:
```javascript
import { Component } from '@angular/core';
import { NguModal, NguModalService } from '@ngu/modal';@Component({
selector: 'sample',
template: `
open modal
......
open modal
`,
})
export class SampleComponent implements OnInit {public sampleText: NguModal;
constructor(
private: modal: NguModalService
) {}ngOnInit() {
this.sampleText = {
id: 'sampleTextID'
}
}openModal() {
this.modal.open(this.sampleText.id);
}closeModal() {
this.modal.close(this.sampleText.id);
}}
```## NguModal Details
```javascript
export interface NguModal {
id: any;
backdrop?: boolean;
width?: Width;
}export interface Width {
xs?: string;
sm?: string;
md?: string;
lg?: string;
fixed?: string;
}
```| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `width` | Object | optional | **xs** - mobile, **sm** - tablet, **md** - desktop, **lg** - large desktops `or` **fixed** - fixed width |
| `id` | any | yes | It is used to identify the modal and it mandatory |
| `backdrop` | boolean | optional | It is used to control the backdrop click event. By default it is `true` |## Getstarted guide
### Single Modal
```javascript
import { Component } from '@angular/core';
import { NguModal, NguModalService } from '@ngu/modal';@Component({
selector: 'sample',
template: `
open modal
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It
has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It
has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
publishing software like Aldus PageMaker including versions of Lorem Ipsum.
open modal
`,
})
export class SampleComponent implements OnInit {public sampleText: NguModal;
constructor(
private: modal: NguModalService
) {}ngOnInit() {
this.sampleText = {
id: 'sampleTextID'
}
}openModal() {
this.modal.open(this.sampleText.id);
}closeModal() {
this.modal.close(this.sampleText.id);
}beforestartModal() {
console.log('beforestartModal');
}afterstartModal() {
console.log('afterstartModal');
}beforeendModal() {
console.log('beforeendModal');
}afterendModal() {
console.log('afterendModal');
}}
```### Multiple Modal
```javascript
import { Component } from '@angular/core';
import { NguModal, NguModalService } from '@ngu/modal';@Component({
selector: 'sample',
template: `
open modal One
Modal One
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It
has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It
has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
publishing software like Aldus PageMaker including versions of Lorem Ipsum.
open modal
open modal Two
Modal Two
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It
has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It
has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
publishing software like Aldus PageMaker including versions of Lorem Ipsum.
open modal
`,
})
export class SampleComponent implements OnInit {public sampleTextOne: NguModal;
public sampleTextTwo: NguModal;constructor(
private: modal: NguModalService
) {}ngOnInit() {
this.sampleTextOne = {
id: 'sampleTextIDOne'
}this.sampleTextTwo = {
id: 'sampleTextIDTwo'
}
}// modal One
openModalOne() {
this.modal.open(this.sampleTextOne.id);
}closeModalOne() {
this.modal.close(this.sampleTextOne.id);
}beforestartModalOne() {
console.log('beforestartModalOne');
}afterstartModalOne() {
console.log('afterstartModalOne');
}beforeendModalOne() {
console.log('beforeendModalOne');
}afterendModalOne() {
console.log('afterendModalOne');
}// modal Two
openModalTwo() {
this.modal.open(this.sampleTextTwo.id);
}closeModalTwo() {
this.modal.close(this.sampleTextTwo.id);
}beforestartModalTwo() {
console.log('beforestartModalTwo');
}afterstartModalTwo() {
console.log('afterstartModalTwo');
}beforeendModalTwo() {
console.log('beforeendModalTwo');
}afterendModalTwo() {
console.log('afterendModalTwo');
}}
```