I am using the angularjs framework to create a form.html and a controller.js. In the controller, I have a variable that retrieves the SSID of a box. My question is, how can I automatically assign the value of this variable in the input field of the form? I want the form to display the SSID without requiring the user to manually enter it.
$scope.SSID {}; return [object Oject] in input form ng-model="SSID"
Any help would be greatly appreciated.
Controller.js
/*Controller*/
'use strict';
angular.module('djoro.controllers')
.controller('WifiSmartConfigCtrl', function($scope, $window, $ionicPlatform) {a
$scope.SSID = {};
$scope.getSSID = function() {
var onSuccess = function(SSID) {
$scope.SSID = SSID;
return SSID;
};
var onFail = function() {};
$ionicPlatform.ready(function() {
$window.cordova.plugins.Smartconfig.getSSID(onSuccess, onFail, $scope.SSID);
});
};
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.20/angular.min.js"></script>
<ion-pane>
<ion-header-bar class="bar-stable">
<h1 class="title">Ionic Blank Starter</h1>
</ion-header-bar>
<ion-content ng-controller="WifiSmartConfigCtrl">
<form novalidate class="simple-form">
<fieldset>
<legend>WI-FI</legend>
<div class="list input-fields">
<label class="item item-input">
<span class="input-label">SSID :</span>
<input type="text" name="test" ng-model="SSID" id="SSID" placeholder="SSID" required show-hide-input>
</label>
<label class="item item-input" show-hide-container>
<span class="input-label">Password :</span>
<input type="passwprd" name="test" placeholder="Password" required show-hide-input>
</label>
</div>
</fieldset>
</form>
</ion-content>
</ion-pane>