I would like to retrieve the password value type for the display in the console.log . I use a html form with ng-model="passwd" to retrieve the value. And I then uses a controller with $scope.passwd=null; to retrieve the input field. For now, $scope.passwd remains null in google chrome => Console
'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>
Someone an idea to edit the entered value ? Thank you
Replace $scope.passwd = null;
to $scope.passwd = '';
You are using ng-click="startSmartconfig()"
and passing nothing but in controller, you have used $scope.startSmartconfig = function(passwd){
so this code will not work.
Set controller function to $scope.startSmartconfig = function(){
and another thing is angularjs is two way binding means when you add value in input text with ng-model="passwd", it also bind the textbox value to $scope.passwd.
I am not aware of $window.cordova
thing but what I observed is you didn't pass passwd
in ng-click="startSmartconfig()"
in html and you are assigning the passwd
to $scope.passwd
which will be undefined.
And no need to pass passwd
in function. You can directly get updated value in $scope.passwd
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.