Angular的ngmodel只在firefox/https中不更新$scope
Angular ngmodel not updating $scope in firefox/https only
我有一个登录表单,它使用ng-model
将数据传递给控制器。当调用ng-submit
时,我将此数据传递给服务器以验证用户。
然而,仅在Firefox中,并且仅在我们的活动(https)服务器上,模型值永远不会更新。使用console.log($scope.loginform)
只是打印默认值:
{ username="", password=""}
在开发中(http),当使用Chrome时,它正确地更新它们与输入的值:
{ username="kermit", password="noteasybeinggreen"}
jade
格式
form(method='post',ng-submit='login()')
ol
li
label(class='icon-user')
input(type='text',name='username',ng-model='loginform.username',placeholder='Username')
li
label(class='icon-key')
input(type='password',name='password',ng-model='loginform.password',placeholder='Password',class='pass')
li
input(type='submit',class='pressable',value='Login')
我的控制器:
.controller('LoginController', ['$scope','$http','$stateParams',function($scope,$http,$stateParams) {
$scope.loginform = {
username: '',
password: ''
};
$scope.login = function() {
console.log( 'login called: ', $scope.loginform );
$http.post('/login', $scope.loginform).success(function(resp, status, headers, config) {
// stuff
})
.error(function(resp, status, headers, config){
// stuff
});
};
}]);
有什么我错过了,做错了,等等?我不明白为什么只有火狐。
本页目前在https://pste.me/#/login
我找到原因了。
似乎当浏览器自动填充用户名/密码字段时,ng-model不会更新。
相关文章:
- ng在更新$scope后重复不更新信息
- 获取Div Width,然后更新Scope Variable
- 在从websocket服务器推送消息后更新$scope变量
- JavaScript未更新$scope变量的一部分
- 如何在Angular中传递此回调并更新$scope
- 离子角 单击按钮后更新$scope变量
- AngularJS:如何在承诺响应后更新$scope
- AngularJS更新$scope变量并输出到pre
- 从 AngularJS 中的服务属性更新$scope
- 更新$scope-dons'不要影响视图
- AngularJS控制器在后端数据更改时自动更新$scope
- 从AngularJS中的服务获取数据后,如何更新$scope是最好的方法
- Angular js 在
标签上的变量更新$scope动画
- 为什么在这种特殊情况下视图没有更新?($scope.$apply)
- 通过更新$scope模型更正条目后,清除角度形式验证
- 当contenteditable Elements使用Angular.js更改时,更新$scope
- Angularjs-在$resource-delete方法的回调中更新$scope的问题(thinkster.io第三章
- Angular JS,在指令中从控制器中更新$scope
- 关闭模式时更新$scope集合
- Ionic:更新$scope变量后重新加载视图