We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
afterNextRender
1 parent e2ad1db commit 55c5817Copy full SHA for 55c5817
src/app/cesium.ts
@@ -1,16 +1,12 @@
1
-import { Directive, ElementRef, OnInit } from '@angular/core';
+import { afterNextRender, Directive, ElementRef, inject } from '@angular/core';
2
import { Viewer } from 'cesium';
3
4
@Directive({
5
- selector: '[appCesium]',
6
- standalone: true
+ selector: '[appCesium]'
7
})
8
-export class Cesium implements OnInit {
9
-
10
- constructor(private el: ElementRef) {}
11
12
- ngOnInit(): void {
13
- const viewer = new Viewer(this.el.nativeElement);
+export class Cesium {
+ constructor() {
+ const el = inject(ElementRef);
+ afterNextRender(() => new Viewer(el.nativeElement));
14
}
15
16
0 commit comments