Can't change `setInputType` to TextField?


I have this markup XML :

<TextField [(ngModel)]="user"  hint="user" #a  id="a"></TextField>

Inside the class I have :

@ViewChild('a') someInput: ElementRef;

But when I do this : (Inside : ngOnInit())< TextField>("a")
                  .setInputType(android.text.InputType.TYPE_CLASS_DATETIME  );

I get :

ERROR TypeError: Cannot read property ‘setInputType’ of undefined

What am I missing ?

(I already know I can do it via keyboard type attribute in markup , But I want to do it imperative).


@Royi_Namir The native view for android is not yet created during ngOnInit. Try running the same code in loaded event of text field or may be a simple timeout can also help.