vkv
vkv

Reputation: 1010

How to show Toast message?

I have a login controller, when i type wrong credentials, it should show a toast message, like password/username not correct.

$scope.doLogin = function() {

    $scope.loginSubmitted = true;
    $scope.loginstatus==0;
    authService.GetByUsername()
        .success(function(data) {
            $scope.UserData = data;
            console.log($scope.UserData);
            for (var i = 0; i < $scope.UserData.length; i++) {
                if ($scope.UserData[i].UserName == $scope.User.UserName && $scope.UserData[i].Password == $scope.User.Password) {
                    $scope.loginstatus=1;
                    break;
                }
            }
            if($scope.loginstatus==1){
                $state.go('app.single')
            }
            else {
                console.log('wrong credentials');
            }

            })
        .error(function(err) {
            console.log(err);
        });
    }

})

Please help me, I dont want to write a new service. Is it possible?

Upvotes: 3

Views: 12363

Answers (1)

user6489054
user6489054

Reputation:

https://codeseven.github.io/toastr/

this link might help you......

Upvotes: 3

Related Questions