我想将模态事件从模态组件传递给模态的父组件,但由于某种原因,我似乎无法让EventEmitter工作.如果有人有想法,将不胜感激.主要代码如下,从ng-bootstrap演示分叉的(非工作)插件在这里:http://plnkr.co/edit/xZhsqBV2mQaPxqFkoE7C?p = preview
app.ts
@Component({
selector: 'my-app',
template: `
<div class="container-fluid" (notifyParent)="getNotification($event)">
<template ngbModalContainer></template>
<ngbd-modal-component ></ngbd-modal-component>
</div>
`
})
export class App {
getNotification(evt) {
console.log('Message received...');
}
}
Run Code Online (Sandbox Code Playgroud)
莫代尔,component.ts
import {Component, Input, Output, EventEmitter} from '@angular/core';
import {NgbModal, NgbActiveModal} from '@ng-bootstrap/ng-bootstrap';
@Component({
selector: 'ngbd-modal-content',
template: `
<div class="modal-body">
<p>Hello, {{name}}!</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" (click)="activeModal.close('Close click')">Close</button>
<button type="button" class="btn btn-secondary" (click)="notify()">Notify</button>
</div>
`
})
export class NgbdModalContent {
@Input() name;
@Output() notifyParent: EventEmitter<any> …Run Code Online (Sandbox Code Playgroud) 我已经尝试使用Google搜索,但是找不到设置。我有一个接受一个生产服务器<?,以及<?php,但我试图使用WAMP的网站,但它不接受<?单独,它坚持使用<?PHP。我可以在WAMP中设置吗?