我想檢索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>
有人的想法編輯輸入的數值? 謝謝
chrome:// inspect,console.log「password = nothing」by $ scope.passwd =''; –
檢查更新後的答案。 –