I have a Bottom Sheet that opens and has a textarea element for users to enter a message. I want this to be auto-focused but I'm pulling the little bit of hair I have left trying to get this trivial little thing to work. The html autofocus does not work here. I have tried the ViewChild thing and used this code in different lifecyle hooks: this.el.nativeElement.focus(); I have created custom directives using two different examples. Nothing works. Oddly, when I use the ViewChild method I can create a test button and run the above code and it gives the element focus as expected. But I run the same code inside a lifecycle hook like ngOnInit or ngAfterViewInit or ngAfterContentInit, it doesn't work. How can that make sense? Oh, and I've tried the Renderer 2 thing. That only resulted in more hair loss. I've triple checked my code against several examples I found Googling. But nothing works. Please help, I want to keep the few hairs I have left. Thanks. Dave
-- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
