-1
我是Angular JS的新手,尝试在浏览器控制台上打印用户名和电子邮件。我要么'未定义',要么正在打印我给的字符串。我怎样才能得到输出为用户输入的电子邮件和用户名?这里是我的代码:console.log()不打印输出
profile.html
<ion-view title="Profile" id="page2">
<ion-content padding="true" class="has-header">
<div ng-controller="profileCtrl"></div>
<div id="profile-form1" class="list">
<label class="item item-input">
<input type="text" placeholder="Email" ng-model="Email">
</label>
<label class="item item-input">
<input type="text" placeholder="Username" ng-model="Username">
</label>
<label class="item item-input" >
<input type="password" placeholder="Password" ng-model="Password">
</label>
<ion-toggle toggle-class="toggle-balanced" id="profile-toggle1" ng-model="tc">Terms & Conditions</ion-toggle>
</div>
<div ng-disabled=" (Email && Username && Password && tc) ? flase : true" ng-click="saveList()" style="border-radius:10px 10px 10px 10px;" class="button button-balanced button-block">Login</div>
</ion-content>
</ion-view>
controller.js
.controller('profileCtrl', ['$scope', '$stateParams',
function ($scope, $stateParams) {
$scope.saveList = function(){
console.log($scope.Email, $scope.Username);
}
}])
控制台输出仅仅是不确定的不确定。
谢谢。
不知道,但你有一个错字:'NG -disabled =“(Email && Username && Password && tc)?flase:true”'flase不是有效的布尔值。 – Shilly
'
'因为该按钮_or其他任何_不在您的控制器中 – George@Shilly如果我不包含'false',即使没有填充任何字段,登录按钮也会被激活。我想没有其他方法可以在字段为空时禁用登录按钮。 – Murali