在我的 AngularJS 模板中,我有以下登录输入字段部分。目前,它正在自动填充输入字段,而不是电子邮件地址,它显示在电子邮件字段中(而不是 [email protected] 等..)
[object Object]
我的模板/ View
<input ng-model="form.email" type="email" name="email" placeholder="Email" autocomplete="off">
使用变量 form.email 的 ng-model(虽然我还看不出它到底来自哪里) - 可能出了什么问题?
最佳答案
确保form.email
应该是字符串
而不是对象
。
工作演示:
var app = angular.module('myApp',[]);
app.controller('MyCtrl',function($scope) {
$scope.form = {
email: "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="31485e4471545c50585d1f525e5c" rel="noreferrer noopener nofollow">[email protected]</a>"
}
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="myApp" ng-controller="MyCtrl">
<input ng-model="form.email" type="email" name="email" placeholder="Email" autocomplete="off">
</div>
关于javascript - 显示在表单输入字段上的“object Object”变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41878802/