Zone parameters always empty #748

Closed
opened 2025-08-09 17:17:31 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @JKetelaar on 5/18/2017

Title

When using Zone.current.get("any param") the result is always null.

Functional impact

Zone.current.get does not work properly.

Minimal repro steps

  1. Install default/latest JavaScriptServices; yo aspnetcore-spa
  2. Add asp-prerender-data='new { }' to the <app/> within index.cshtml
  3. For example add cookies as a data object; cookies = ViewContext.HttpContext.Request.Cookies
  4. Within any part of the module, add Zone.current.get('cookies') and print this somehow
  5. The result is now undefined

Expected result

Instead of get returning undefined, return the actual result.

Actual result

get returns undefined instead.

Further technical details

When printing the entire zone, the properties are also empty:

Microsoft.AspNetCore.NodeServices:Information: Zone {
  _properties: { isAngularZone: true },
  _parent: 
   Zone {
     _properties: {},
....
}

This also causes issues with angular2-cookie, as it's requesting Zone.current.get('req'), which is undefined too;
This console.log(cookieService.getAll()); causes:

Exception: Call to Node module failed with error: Error: Uncaught (in promise): TypeError: Cannot read property 'headers' of undefined
TypeError: Cannot read property 'headers' of undefined

Am I missing anything or is this the expected result due to a bug?

*Originally created by @JKetelaar on 5/18/2017* ### Title When using `Zone.current.get("any param")` the result is always null. ### Functional impact `Zone.current.get` does not work properly. ### Minimal repro steps 1. Install default/latest JavaScriptServices; `yo aspnetcore-spa` 2. Add `asp-prerender-data='new { }'` to the `<app/>` within index.cshtml 3. For example add `cookies` as a data object; `cookies = ViewContext.HttpContext.Request.Cookies` 4. Within any part of the module, add `Zone.current.get('cookies')` and print this somehow 5. The result is now undefined ### Expected result Instead of `get` returning undefined, return the actual result. ### Actual result `get` returns undefined instead. ### Further technical details When printing the entire zone, the properties are also empty: ``` Microsoft.AspNetCore.NodeServices:Information: Zone { _properties: { isAngularZone: true }, _parent: Zone { _properties: {}, .... } ``` This also causes issues with [angular2-cookie](https://github.com/salemdar/angular2-cookie), as it's requesting [`Zone.current.get('req')`](https://github.com/salemdar/angular2-cookie/blob/74d6434669eb235ee05a46f8219222a67c92dc8c/src/services/cookies.backend.service.ts#L12), which is undefined too; This `console.log(cookieService.getAll());` causes: ``` Exception: Call to Node module failed with error: Error: Uncaught (in promise): TypeError: Cannot read property 'headers' of undefined TypeError: Cannot read property 'headers' of undefined ``` Am I missing anything or is this the expected result due to a bug?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#748
No description provided.