密码保护应用程序在离子/角度

时间:2015-04-05 22:38:33

标签: javascript angularjs ionic

我正在创建一个应用程序,我想要密码保护它没有密码的人。基本上,我想要一个模式来显示是否输入了密码,并且不显示是否输入了密码。

你能帮帮我吗?这是我的代码:



 
.controller('AppCtrl',function($scope, $ionicModal){
  $scope.password = {
    name: 'Mittens Cat'
  }

  $ionicModal.fromTemplateUrl('templates/modal.html', {
    scope: $scope,
    animation: 'slide-in-up'
  }).then(function(modal) {
    $scope.modal = modal
  })  

  $scope.openModal = function() {
    $scope.modal.show()
  }

  $scope.closeModal = function(password) {
    if (angular.copy(password) == "password") {
    $scope.modal.hide();
    }
  };

  $scope.$on('$destroy', function() {
    $scope.modal.remove();
  });
})
.controller('LoginCtrl', function($scope) {
    $scope.update = function(password) {
        $scope.master = angular.copy(password);
      };
})

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div class="modal" ng-controller="LoginCtrl">
      <ion-header-bar>
        <h1 class="title">Enter Password</h1>
      </ion-header-bar>
      <ion-content>
        <div class="list">
          <label class="item item-input">
            <span class="input-label">Password</span>
            <input type="password" ng-model="password.value">
          </label>
        </div>

        <button class="button button-full button-energized" ng-click="closeModal()">Done</button>
      </ion-content>
    </div>
&#13;
&#13;
&#13;

0 个答案:

没有答案