【问题标题】:angularjs -> material -> select -> options -> only on mobile -> not workingangularjs -> 材料 -> 选择 -> 选项 -> 仅在移动设备上 -> 不工作
【发布时间】:2017-11-13 19:40:35
【问题描述】:

选择选项在桌面上运行良好,但是当您在刷新后在移动页面上尝试时,它不会显示选项。 有人可以帮我安排吗?

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

【问题讨论】:

    标签: angularjs select options angularjs-material


    【解决方案1】:

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

    [...]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
    

    (在函数attachToDocument 中从angular-material.js 中的cmets 中提取)。

    如果您想禁用此行为,您可以在引导过程中configure 它。在myApp变量的定义后面加上这段代码:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-28
      • 2017-12-27
      • 1970-01-01
      • 2018-06-14
      • 2017-07-14
      • 1970-01-01
      相关资源
      最近更新 更多