Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(window): add component instance property to window ref #2858

Merged

Conversation

katebatura
Copy link
Contributor

@katebatura katebatura commented Sep 6, 2021

Please read and mark the following check list before creating a pull request:

Short description of what this resolves:

Closes #2367

Added componentInstance property to NbWindowRef contains the instance of the component opened into he window.

How to use:

// window component
...
onAdd = new EventEmitter();

onButtonClick() {
  this.onAdd.emit();
}
...
// parent component
...
constructor(private windowService: NbWindowService) {}

openWindow() {
  let windowRef<Component> = this.windowService.open(Component);

  const sub = windowRef.componentInstance.onAdd.subscribe(() => {
    // do something
  });
  windowRef.onClose().subscribe(() => {
    // unsubscribe onAdd
  });
}
...

@katebatura katebatura requested a review from yggg September 6, 2021 14:21
componentRef: ComponentRef<NbWindowComponent>;
windowContentInstance: T;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

componentInstance

@katebatura katebatura changed the title feat(nb-window): windowContent instance feat(window): instance of the component opened into winow Sep 14, 2021
@katebatura katebatura changed the title feat(window): instance of the component opened into winow feat(window): instance of the component opened into window Sep 14, 2021
@@ -7,9 +7,11 @@ import { NbWindowConfig, NbWindowState, NbWindowStateChange } from './window.opt
* The `NbWindowRef` helps to manipulate window after it was created.
* The window can be dismissed by using `close` method of the windowRef.
* You can access rendered component as `componentRef` property of the windowRef.
* Property `windowContentInstance` contains the instance of the component opened into the window.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Property `windowContentInstance` contains the instance of the component opened into the window.
* Property `contentInstance` contains the instance of the component opened in the window.

@yggg yggg changed the title feat(window): instance of the component opened into window feat(window): add component instance property to window ref Sep 15, 2021
@yggg yggg merged commit fcf1a08 into akveo:master Sep 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NbWindow: Getting windowContent instance through WindowRef
2 participants