akveo / akveo/nebular

Getting @Output event emitters from wrapped component in Window modal

Open
#2,548 2 comments 3 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
8.1k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

### Issue type

**I'm submitting a ...** (check one with "x")

* [ ] bug report
* [x ] feature request

### Issue description

**Current behavior:**
Currently, I can't seem to find a way to subscribe to (`@Output`) event emitters from the component passed into the window modal when it is being created, I can only pass in data through context but can't seem to find a way to subscribe to data passed from the wrapped component.

**Expected behavior:**
```.ts
// component being passed into the window service modal
class PassedInComponent {
@Output() onSomeAction = new EventEmitter();

@Input() text;
}

// component where the modal is being called
const windowModal = this.windowService.open(
PassedInComponent,
{ title: 'some title', context: { text: 'the-data' } },
);

windowModal.componentRef.instance.content.onSomeAction.subscribe((val) => {
// being able to subscribe to "onSomeAction" and get its data to use
console.log(val);
});
```

**Steps to reproduce:**
As described in the expected behaviour above

**Related code:**
```.ts
//
```

### Other information:

**npm, node, OS, Browser**
```
Node: v14.9.0,
npm: 6.14.8
OS: MacOS Catalina
Browser: Chrome
```

**Angular, Nebular**
```
Angular, Nebular Framework
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.