【问题标题】:What is the equivalent of ng-blur in ionicframework?ionicframework 中 ng-blur 的等价物是什么?
【发布时间】:2016-02-07 11:49:05
【问题描述】:

我有一个像这样的离子角度模板文件:

<ion-list>
<!-- Search Hotels -->
<div class="list list-inset">
  <label class="item item-input">
    <i class="icon ion-search placeholder-icon"></i>
    <input type="text" placeholder="Search" ng-model="hotelSearch" ng-focus="tap.focus()" ng-blur="tap.blur()">
  </label>
</div>

<!-- List of Hotels -->
<ion-item class="item-remove-animate item-avatar item-icon-right" ng-repeat="hotel in hotels |filter: hotelSearch | orderBy: '-popularity' | limitTo: 10" type="item-text-wrap" href="#/tab/hotels/{{hotel.id}}" ng-show="tap.tapped">
  <img ng-src="">
  <h2>{{hotel.name}}</h2>
</ion-item>

当我使用ionic serve 在浏览器中使用它时,它可以完美运行。但在android模拟器中失败。 ng-focus 可以使用on-tap 模拟。

离子框架中ng-blur的等价物是什么?

【问题讨论】:

    标签: android angularjs ionic-framework ionic directive


    【解决方案1】:

    随便用

    onblur="fnx()"
    

    它可能会工作!

    【讨论】:

    • 这只有在fnx()是一个全局函数而不是一个Angular作用域函数时才有效。
    【解决方案2】:

    This answer 为我指明了正确的方向:如果您在控制器中定义了类似的功能:

    $scope.blurCallback = function(){
        // do some amazing stuff here ...
    }
    

    然后在你的标记中你可以使用:

    <input ... onblur="angular.element(this).scope().blurCallback()">
    

    【讨论】:

      猜你喜欢
      • 2019-03-29
      • 1970-01-01
      • 2015-11-13
      • 2014-05-08
      • 2014-06-12
      • 1970-01-01
      • 2022-11-28
      • 2021-06-19
      • 2012-07-20
      相关资源
      最近更新 更多