Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
modals-manager
Advanced tools
Readme
Adding modal from component instead of HTML
npm install modals-manager@latest --save
Following are the things you must have before installation:-
Installation guide Angular CLI
Installation guide Bootstrap 4 with css or scss
Installation guide NgxBootstrap
Step1: Include Modals Manager in your application
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
import { ModalsManagerModule } from 'modals-manager';
@NgModule({
imports: [
BrowserModule,
ModalsManagerModule.forRoot(),
NgbModule.forRoot()
],
declarations: [ AppComponent ],
exports: [ AppComponent ]
})
export class AppModule {}
Step2. Add component in application
<!-- app.component.html -->
...
<app-modal-manager></app-modal-manager>
Step3. Create a dynamic modal and add it as entry component in application
// alert.component.ts
import {Component, Input} from '@angular/core';
import {NgbActiveModal} from '@ng-bootstrap/ng-bootstrap';
@Component({
selector: 'app-alert-modal',
templateUrl: 'alert-modal.component.html'
})
export class AlertModal {
@Input() inputs;
constructor(public activeModal: NgbActiveModal) {
}
}
<!-- alert.component.html -->
<div class="modal-header">
<h4 class="modal-title">Hi there!</h4>
<button type="button" class="close" aria-label="Close" (click)="activeModal.dismiss('Cross click')">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<p>Hello, {{inputs.name}}!</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-dark" (click)="activeModal.close('Close click')">Close</button>
</div>
Step4. Declare modal in application
...
import { AlertModal } from './alert-modal.component';
@NgModule({
declarations: [
...,
AlertModal
],
entryComponents: [
...,
AlertModal
]
})
export class AppModule {
...
}
Step5. Open modal from component
// app.component.ts
import { Component, OnInit, AfterViewInit } from '@angular/core';
import { ModalsManagerModule, ModalsManagerService } from 'modals-manager';
import { AlertModal } from './alert-modal.component';
@Component({
templateUrl: 'app.component.html'
})
export class AppComponent{
constructor(private modalsManagerService: ModalsManagerService ) {
}
openModal() {
this.modalsManagerService.showModal({
component: AlertModal,
callback: (result) => {
console.log(result);
},
payload: {
name: 'BIZ TECNO'
}
})
}
}
<button class="btn btn-lg btn-outline-primary" (click)="openModal()">Launch Alert modal</button>
FAQs
Modal manager which will add component in app dynamically
The npm package modals-manager receives a total of 6 weekly downloads. As such, modals-manager popularity was classified as not popular.
We found that modals-manager 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.