0
我使用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>
看起来你已经错过了加入NG-应用指令。你应该这样做 -。 –
Rabi