You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Native element not available in AfterViewInit on android #4396
The native element is not available inside AfterViewInit on Android but is available on ios.
For example:
import {AfterViewInit, Component} from "@angular/core";
import {Page} from "tns-core-modules/ui/page";
import {Label} from "tns-core-modules/ui/label";
@Component({
selector: "lifecycle",
moduleId: module.id,
template: `
<GridLayout columns="auto" rows="auto">
<Label id="label1" col="0" row="0"></Label>
</GridLayout>
`
})
export class Lifecycle implements AfterViewInit {
private _page: Page;
constructor(page: Page) {
this._page = page;
}
public ngAfterViewInit(): void {
let label: Label = this._page.getViewById<Label>("label1");
// label.android will be undefined on android
console.log("ngAfterViewInit: " + label.android + label.ios);
}
}
label.android will be undefined when running on android. label.ios is defined when running on ios.
I would expect EVERYTHING to be loaded and ready when ngAfterViewInit is fired. Because the view is supposed to be ready at that point.
I know you can subscribe to loaded on the element to know when it is finished loading, but i would expect AfterViewInit to be called after the entire "dom" is loaded and ready.
Activity
NickIliev commentedon Jun 16, 2017
This issue was moved to NativeScript/nativescript-angular#848
lock commentedon Aug 28, 2019
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.