Tuesday, 15 February 2011

javascript - Angular ngmodel not updating $scope in firefox/https only -



javascript - Angular ngmodel not updating $scope in firefox/https only -

i have login form uses ng-model pass info controller. when ng-submit called, pass info server authenticate user.

however, in firefox only, , on our live (https) server, model values never updated. using console.log($scope.loginform) prints default values:

{ username="", password=""}

in development (http), , when using chrome, updates them entered values:

{ username="kermit", password="noteasybeinggreen"}

here's form, in jade format

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')

and controller:

.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 }); }; }]);

is there i'm missing, doing wrong, etc? can't understand why it's firefox.

this page live @ https://pste.me/#/login

i found cause.

it seems when browser auto-fills username/password field, ng-model doesn't update.

see angularjs browser autofill workaround using directive possible fixes.

javascript angularjs

No comments:

Post a Comment