2

私はhtmlのようなdivを持っています

<div class="row" ng-show="loginCtrl.showTouchID" >
    <div class="col-xs-12">
                    <button type="button" class="col-xs-12 btn btn-touch-id" data-ng-click="#">
                        TouchID Login
                    </button>
                </div>
            </div>

デバイスがタッチIDをサポートしているかどうかをコントローラーコンストラクターで確認する必要があります。

  window.plugins.touchid.isAvailable(
            function (msg) {
                navigator.notification.alert('Touch id  supported: ' + msg);
                loginCtrl.showTouchID=true;


            }, function (msg) {
                navigator.notification.alert('Touch id not supported: ' + msg);
                loginCtrl.showTouchID=false;

            });

しかし、これはうまくいきません、誰かが私を修正できますか

ログインコントローラーの下

  angular.module('heritage').controller('LoginCtrl', LoginCtrl);
    LoginCtrl.$inject = ['$scope','$rootScope', '$state', '$window', 'UserService', 'ServiceHelper', '$stateParams'];

    /**
     * Construct the controller.
     * @param $rootScope the root scope
     * @param $state the state object
     * @param $window the window object
     * @param UserService the user service
     * @returns the controller object
     */
    function LoginCtrl($scope,$rootScope, $state, $window, UserService, ServiceHelper, $stateParams) {
4

2 に答える 2

2

$scopeを関数に渡し(外部の場合)、$scopeそこで変数を変更します。

  window.plugins.touchid.isAvailable($scope
            function (msg) {
                navigator.notification.alert('Touch id  supported: ' + msg);
                $scope.showTouchID=true;


            }, function (msg) {
                navigator.notification.alert('Touch id not supported: ' + msg);
                $scope.showTouchID=false;

            });
于 2015-11-24T06:24:40.590 に答える