angularjs - >材料 - >选择 - >选项 - >仅在手机上 - >不工作

时间:2017-06-12 10:49:18

标签: angularjs select options material

选择在桌面上工作正常的选项,但是当您在刷新后在移动页面上尝试它时,它不会显示选项。 有人可以帮助我吗?

plunker https://embed.plnkr.co/FMvR2vKh5W8D8Fbbx11R/

1 个答案:

答案 0 :(得分:1)

根据Angular Material代码中的评论,他们似乎劫持了移动模式下的所有点击,以防止旧版浏览器上的一些鬼点击:

[...]we preventDefault any click that wasn't sent by ngMaterial. This is 
because on older Android & iOS, a false, or 'ghost', click event will be 
sent ~400ms after a touchend event happens. The only way to know if this 
click is real is to prevent any normal click events, and add a flag to
events sent by material so we know not to prevent those.

Two exceptions to click events that should be prevented are:
  - click events sent by the keyboard (eg form submit)
  - events that originate from an Ionic app

(摘自函数angular-material.jsattachToDocument中的评论)。

如果要禁用此行为,可以在引导期间configure。在myApp变量的定义之后添加此代码:

myApp.config(function($mdGestureProvider){ 
  $mdGestureProvider.skipClickHijack();
})