
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
ngx-basic-modal
Advanced tools
Style-agnostic modals for Angular applications
This library is intended only to provide the modal main features which are:
Styling of the modal window is up to the developer.
To install this library, run:
$ npm install ngx-basic-modal --save
and then from your Angular AppModule
:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
// Import NgxModalModule
import { NgxModalModule } from 'ngx-basic-modal';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
// Specify it as an import and call .forRoot()
NgxModalModule.forRoot()
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
NgxModalService
allows you to render a component inside a modal, with the possibility to retrieve an eventual result once the modal is closed.
You can follow the steps below to see how it works, or check out the playground folder of this repo.
Inject NgxModalService
in the container component's constructor and use it as follows:
export class AppComponent {
constructor(private modal: NgxModal) {}
openModal() {
const modal = this.modal.open(ModalContentComponent);
// set inputs
modal.componentInstance.exampleInput = 'hey i am a string';
// listen for outputs
modal.componentInstance.exampleOutput
.subscribe(value => console.log('emitted', value));
// retrieve the result when the modal it's closed
modal.result.then(res => console.log('this is your result', res));
}
}
In the component which will be the modal content inject NgxActiveModal
to control the instance:
export class ModalContentComponent {
@Input()
exampleInput: string;
@Output()
exampleOutput = new EventEmitter();
constructor(private activeModal: NgxActiveModal) {}
closeMe() {
this.activeModal.close('hey i am a result');
}
}
Contributions are welcome! Use pull requests to collaborate.
To generate all *.js
, *.d.ts
and *.metadata.json
files:
$ npm run build
To lint all *.ts
files:
$ npm run lint
MIT © Alessandro Mitelli
FAQs
Style-agnostic modals for Angular applications
We found that ngx-basic-modal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.