【发布时间】:2015-09-23 12:08:20
【问题描述】:
我想检索 console.log 中显示的密码值类型。 我使用带有 ng-model="passwd" 的 html 表单来检索值。 然后我使用带有 $scope.passwd=null; 的控制器。检索输入字段。 目前,谷歌浏览器中的 $scope.passwd 仍然为空 => 控制台
'use strict';
angular.module('djoro.controllers')
.controller('WifiSmartConfigCtrl', function($scope, $window, $ionicPlatform){
$scope.passwd = null;
$scope.startSmartconfig = function(passwd){
var onSuccess = function(success){
$scope.passwd = passwd;
};
var onFail = function(){};
$ionicPlatform.ready(function(){
$window.cordova.plugins.Smartconfig.startSmartconfig(onSuccess, onFail, $scope.passwd);
console.log('Password = ' + $scope.passwd);
});
};
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<form name="wifi_form" class="simple-form">
<div class="list input-fields">
<label class="item item-input" show-hide-container>
<span class="input-label">Password : </span>
<input type="password" name="password" ng-model="passwd" id="passwd" show-hide-input>
</label>
</div>
</form>
<div class="startWifi">
<button class="button button-full button-balanced" ng-click="startSmartconfig()">Start</button>
</div>
有人想编辑输入的值吗? 谢谢
【问题讨论】:
标签: javascript angularjs angular-ngmodel angularjs-ng-model