lundi 2 novembre 2015

Checkbox in angular issue

I define a checkbox in angular like this :

<input type="checkbox" id="rememberMe" name="rememberMe" ng-model="model.rememberMe" value="1" />

and in my controller i have :

  app.controller('loginController', function ($http, $scope) {

    $scope.login = function () {
        $scope.model.rememberMe = $scope.rememberMe == undefined ? false : true;       
        $http.post("/Accounts/UserLogin", $scope.model).success(function (response) {
            $scope.message = response;
        });
    }
});

but in console i have an error :Cannot set property 'rememberMe' of undefined, what is the problem?




Aucun commentaire:

Enregistrer un commentaire