Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typescript 离子3将ID绑定到<;文本区>;_Typescript_Ionic Framework_Ionic3 - Fatal编程技术网

Typescript 离子3将ID绑定到<;文本区>;

Typescript 离子3将ID绑定到<;文本区>;,typescript,ionic-framework,ionic3,Typescript,Ionic Framework,Ionic3,是否可以将ID绑定到文本区域 比如: <ion-textarea placeholder="Enter your thoughts" id="thoughtsBox"></ion-textarea> 非常感谢你当然能做到。你使用它的方式是正确的 我尝试了这个,我的应用程序在函数调用时崩溃:document.getElementById('ThoughtBox').focus()我通过Logcat获得此错误:chromium:[INFO:CONSOLE(56113)]

是否可以将ID绑定到文本区域

比如:

<ion-textarea placeholder="Enter your thoughts" id="thoughtsBox"></ion-textarea>


非常感谢

你当然能做到。你使用它的方式是正确的

我尝试了这个,我的应用程序在函数调用时崩溃:
document.getElementById('ThoughtBox').focus()我通过Logcat获得此错误:
chromium:[INFO:CONSOLE(56113)]“[WARN]TypeError:cannotreadproperty'focus'of null”,来源:file:///android_asset/www/build/main.js (56113)
我用过这个:-试着用一下这个可能对你也有用:-setTimeout(()=>{document.getElementById('broadcast-textarea')).focus();Keyboard.show();},750)@MrFlyingToasterman请尝试使用它,如果它不起作用,请告诉我是否需要为键盘导入一些内容?Atom找不到键盘。。你能给我写一个小样本代码吗?我还没有使用Ionic和TypeScript的经验。从“Ionic native”导入{Keyboard};在导入部分写下这句话:您是否试图将焦点设置为具有该id的元素?是的,就像下面的
document.getElementById('thoughtsBox').focus()一样