1 <input type="search"/>

发现在iOS 上没有显示search key  只显示了return key ....

原来是需要在input的前加上 form 便签才会显示search blue button  ...

1 <form>
2 <input type="search"/>
3 </form>

我想通过点击search blue button 来处理search 的结果,所以我用了 angular的指令的方法  来绑定键盘的search events 

 1 // 键盘的search 按钮绑定事件
 2 .directive('mysearch',function(){
 3     return {
 4         restrict:'EAC',
 5         scope:{
 6           gotosearch:'&searchinfo'
 7         },
 8         link:function(scope,ele,attrs,ctrl,trans){
 9             ele.bind('search',function(){
10                 scope.$apply(function(){
11                     // alert("search");
12                     scope.gotosearch();
13 
14                 })
15             });
16         }
17     }
18   })

当点击search button时 调用了指令的gotosearch函数. 而scope 的函数gotosearch 是用属性 searchinfo 在HTML 页面中

<input type="search" searchinfo="ctrollfunction()"/>

在者就是 ctrollfunction 是父控制器的一个函数

即 ctrollfunction-->searchinfo-->gotosearch

posted on 2014-10-23 19:34  ทดสอบ  阅读(197)  评论(0)    收藏  举报