Javascript console.log()未打印输出
我是Angular JS新手,尝试在浏览器控制台上打印用户名和电子邮件。我要么得到“未定义”,要么它正在打印我给出的字符串。如何获得用户输入的电子邮件和用户名输出?这是我的密码: profile.htmlJavascript console.log()未打印输出,javascript,angularjs,ionic-framework,Javascript,Angularjs,Ionic Framework,我是Angular JS新手,尝试在浏览器控制台上打印用户名和电子邮件。我要么得到“未定义”,要么它正在打印我给出的字符串。如何获得用户输入的电子邮件和用户名输出?这是我的密码: profile.html <ion-view title="Profile" id="page2"> <ion-content padding="true" class="has-header"> <div ng-controller="profileCtrl"></di
<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>
控制台输出只是未定义
谢谢。不要关闭div:
不要忘记关闭div
标签:
<ion-view title="Profile" id="page2">
<ion-content padding="true" class="has-header">
<div ng-controller="profileCtrl"> <!-- open it here -->
<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>
</div> <!-- close it here -->
</ion-content>
</ion-view>
条款及;条件
登录
不确定它是否与问题有关,但您有一个输入错误:ng disabled=“(Email&&Username&&Password&&tc)?flase:true“
flase不是有效的布尔值。
因为该按钮或任何其他内容不在您的controller@Shilly如果我不包括'false',即使没有填写任何字段,登录按钮也会被激活。我想当字段为空时,没有其他方法可以禁用登录按钮。我的意思是您将“false”拼写为“flase”,JS无法将其转换为正确的布尔值false。啊。。。我抓到你了。谢谢你纠正这个错误。
<ion-view title="Profile" id="page2">
<ion-content padding="true" class="has-header">
<div ng-controller="profileCtrl"> <!-- open it here -->
<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>
</div> <!-- close it here -->
</ion-content>
</ion-view>