Search code examples
angularjstoastr

Toastr Notification not working inside of success function ( Angular JS 1.6.6 )


For some reason, when I am trying to create toastr notifications inside of the below data service success function, they are not working, but if I take them out of that they are.. Any ideas why and how to fix this? Thanks for your time.


Solution

  • Angular 1.6 doesn't have success function: Use it like below:

    $http({
                url: urlToServer,
                method: "POST",
                //cache: false,
                data: jQuery.param(dataObj),
                headers: {'Content-Type': 'application/x-www-form-urlencoded'}
            }).then(function (res){
              alert("success", "Hoorey", "Verified");
            },function (error){
              alert("warning", "Oops!", "Could NOT Login");
           });