My $cordovaDialogs.alert is not working in my browser

.controller(‘LoginCtrl’, function($scope, $state, $rootScope, $cordovaDialogs, LoginService){

$scope.form = {};

$scope.submit = function(){

// TODO: Add some native loading

if((angular.isDefined($scope.form.username) 
  && $scope.form.username !== "") 
  && angular.isDefined($scope.form.password) 
  && $scope.form.password !== ""){

  LoginService.login($scope.form).then(function(response){
    var str = response.data;
    str.replace(/\s/g, '');
    
    if(str === "1")
    {
      $cordovaDialogs.alert('Login success!', 'Login', 'Ok').then(function() {
        // callback success
      });
      if(Storage){
        localStorage.setItem('loginDetails', JSON.stringify($scope.form));
      } else {
        $cordovaDialogs.alert('Storage is not defined in this browser. Please use other storage.', 'Login', 'Ok').then(function() {
        // callback success
        });
      }
    }
  }, function(error){

  });
  $state.go('tab.chats');

} else {
  // TODO: Add native message box
}

}

});

why dont u use $ionicPopup?

can you give me some example for that? on how to use $ionicPopup in my code…

I think my problem here @harith5757 is that my code “if (str === “1”)” is not recognized so $cordovaDialogs.alert did
not execute…

can i know what is the response?

image this is the response after login… but then $cordovaDialogs and also the localStorage didn’t execute,

lol that is the header. i need the response… haha

the outcome after clicking the button login?

it is the response “1” because the headers look like this image

LoginService.login($scope.form).then(function(response){
console.log(response);
});

can console this one?

image this is the result @harith5757

LoginService.login($scope.form).then(function(response){
      if(response.data === '1'){
            $ionicPopup.alert({
                 title: 'Login',
                 template: 'Success!'
            }).then(function(res) {
                $state.go('app.home')//u can change it here later
           });
       }
});

can you try this one? lol…

@Ro2loginid tnx for that sir but the ionicPopup.alert and $state.go didnt
execute but the response is correct…

tnx for that sir but the $ionicPopup.alert and $state.go didnt execute but
the response is correct…

you need to inject $state and $ionicPopup

Do you inject $cordovaDialogs?

yes i inject it… i think its a technical error…