Support zoneless applications
See original GitHub issueI’m submitting a…
[X] Bug report
Current behavior
When used within Angular Element application without zone.js, translation pipe does not work, translations keys are not translated nor visible.
What i tried already:
- run
ChangeDetectorRef.markForCheck()
orChangeDetectorRef.detectChanges()
in various app lifecycles hooksngOnInit, ngAfterViewInit, ngOnChanges
- run
ApplicationRef.tick()
in various app lifecycles hooksngOnInit, ngAfterViewInit, ngOnChanges
- change
ChangeDetectionStrategy
toOnPush
but nothing helps…
Expected behavior
To work transloco as expected i.e. translate keys into texts.
Minimal reproduction of the problem with instructions
- scaffold new Angular Elements app
- import
'@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js'
insrc\polyfills.ts
- import
'document-register-element'
insrc\polyfills.ts
- remove
zone.js
fromsrc\polyfills.ts
- add
{ ngZone: 'noop' }
insrc\main.ts
and here is a demo https://stackblitz.com/edit/angular-xb7xmc
What is the motivation / use case for changing the behavior?
To work transloco translations in Angular Elements (Web Components) applications without zone.js.
Environment
Angular version: 9.1.3
Browser:
- [X] Chrome (desktop) version 81.0.4044.129 (Official Build) (64-bit)
Others:
- @angular/elements: 9.1.3
- document-register-element: 1.14.3
- @webcomponents/webcomponentsjs: 2.4.3
Issue Analytics
- State:
- Created 3 years ago
- Comments:11
Top Results From Across the Web
Going fully Zone-Less! High-Performance Angular ... - YouTube
Go fully Zone-Less in your Angular application in the post IVY era!! The async pipe is boring! Understand the guts of Angulars change ......
Read more >Quantum Angular: Maximizing Performance by Removing Zone
If your application needs a special performance target, disabling Zone can help deliver better performance for your application: an example ...
Read more >NgZone - Angular
A zone is an execution context that persists across async tasks. You can think of it as thread-local storage for the JavaScript VM....
Read more >Reactive Angular with ngrx/component - Chris Kohler
Zone less approach in Angular; Change detection in a reactive application; Async Pipe; ngrx PushPipe and let directive ...
Read more >Zenless Zone Zero Official Site
Zenless Zone Zero is a brand new action game. The story takes place in the near future, where a mysterious natural disaster known...
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 Free
Top 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
@emzet, @cgatian, @itayod here is a working example https://stackblitz.com/edit/angular-hbppzv?file=src/app/app.module.ts
All the magic is here. This solution was tested on very big application. That app is configured to be zoneless and all is working as expected. The trick is to delay a bit change detection process to prevent races.
Oh wow, I know that @ngrx/component is going to enable a lot more apps to opportunity to drop zone. And the lack of Angular Elements without zone. That hurts.