大佬教程收集整理的这篇文章主要介绍了ionic-framework – 如何从Ionic2中的离子输入中获取包裹的输入?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经尝试创建一个指令并使用传入的ElementRef
import {Directive,ElementRef,Input} from 'angular2/core'; @Directive({ SELEctor: '[LOCATIOn-picker]' }) export class LOCATIOnPicker { constructor(el: ElementRef) { console.log(el.nativeElement); } }
但nativeElement返回包装的输入.
<ion-input LOCATIOn-picker=""> <input class="text-input ng-valid ng-dirty ng-touched" type="text" placeholder="" aria-labelledby="lbl-6" LOCATIOn-picker="" autocomplete="off" autocorrect="off"> <!--template bindings={}--> <!--template bindings={}--> <!--template bindings={}--> </ion-input>
我也尝试创建类似于this的自定义组件并将Searchbar切换到TexTinput,但TexTinput没有.inputElement`.
任何想法都会受到欢迎.
谢谢!
<ion-input LOCATIOn-picker=""> <input #myInput class="text-input ng-valid ng-dirty ng-touched" type="text" placeholder="" aria-labelledby="lbl-6" LOCATIOn-picker="" autocomplete="off" autocorrect="off"> <!--template bindings={}--> <!--template bindings={}--> <!--template bindings={}--> </ion-input>
@ViewChild('myInput') input; ngAfterViewInit() { console.log(this.input.nativeElement.value); }
另见angular 2 / typescript : get hold of an element in the template
以上是大佬教程为你收集整理的ionic-framework – 如何从Ionic2中的离子输入中获取包裹的输入?全部内容,希望文章能够帮你解决ionic-framework – 如何从Ionic2中的离子输入中获取包裹的输入?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。