NbWindowService - context no longer works
See original GitHub issueIssue type
I’m submitting a … (check one with “x”)
- bug report
- feature request
Issue description
Current behavior:
I just upgraded from 3.0.0 to 3.3.0, and now the context property no longer works when creating a window.
It appears the example app/demo is not working either: https://akveo.github.io/nebular/example/window/template-window.component
Expected behavior:
When passing in an object as the context, I would expect my component to have access to that data, according to the docs: “For components, this data will be set as component properties.”
Steps to reproduce:
Pass a context property to the configuration of a window.
Related code:
The code below works on 3.0.0, but after the upgrade it doesn’t work:
parent.component.ts:
this.windowService.open(MyComponent,
{ title: 'Details', context: { records: row.data} }
);
my.component.ts:
ngOnInit() {
// should output data
console.log(this.records);
}
Other information:
npm, node, OS, Browser
npm 5.6.0
Angular, Nebular
"@angular/cdk": "^7.2.1",
"@angular/common": "^7.2.1",
"@angular/compiler": "^7.2.1",
"@angular/core": "^7.2.1",
"@angular/forms": "^7.2.1",
"@angular/http": "^7.2.1",
"@nebular/auth": "3.3.0",
"@nebular/bootstrap": "3.3.0",
"@nebular/security": "3.3.0",
"@nebular/theme": "3.3.0",
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
How do I reference the component's instance of a NbWindow
windowService's open() method accepts a context object that can be injected in the target window component, so we can use it to make...
Read more >Window Angular UI Component - Nebular - GitHub Pages
The NbWindowService can be used to open windows. Showcase ... Also you can get reference to the NbWindowRef in context's windowRef property.
Read more >Setting Nebular Modal Size: My Approach - Leonel Elimpe
... with this setup however the modal has the tendency to not adjust ... I've had a look at the bootstrap modal (which...
Read more >Box Remaining On Screen In Windows 10/8/7 FIX - YouTube
Right Click Context Menu Not Disappearing - Box Remaining On Screen In Windows 10/8/7 FIX. This error which causes the context menu (or...
Read more >How to use NbWindowService in nebular to open a form in another ...
But it does not show the content in the .html file in 'FormComponent'. Can anyone show me the place where I have gone...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks, @swbradshaw. So the issue is that context is set after window component was initialized, right? We’ll look into this. As a workaround, for now, you can inject window context using
NB_WINDOW_CONTEXT
injection token. This way it will be available right off.I just tested this fix on 3.4.1, and it does not work.
If I setup breakpoints in the code, I can see that
NbWindowService.prototype.appendWindow
callsref.changeDetectorRef.detectChanges();
but the code never continues; a breakpoint on the next linereturn ref;
is never hit. When the window launches my component, I have a breakpoint inngOnInit
, and the context object is missing. It seems like the Window component doesn’t attach until thengAfterViewChecked
life cycle, which is well after the component has done its init.Downgrading back to an older version again.