Я использую структуру angularjs, я создал form.html и controller.js с переменной, которая извлекает SSID поля. Как автоматически назначить значение переменной в форме. Это поле ввода. При запуске приложения форма должна автоматически отображать SSID, если пользователь не должен этого делать.
$scope.SSID {}; return [object Oject] in input form ng-model="SSID"
Благодарим вас.
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>
выглядит, как вы пропустили добавить директиву нг-приложение. вы должны сделать это, как:. –
Rabi