0

I have the following code (AJS + Cordova):

$scope.update = function () {
        myService.update()
          .then(function (response) {
            
            $scope.result = response.data;//prints [Object object]
            console.log("Success!..." +  response.data + "result.." + $scope.result); 

            angular.forEach($scope.result, function(value, key){
               
                console.log(key + ': ' + value); //prints success:true
               
               // $location.url(""+urlToGo);
                $window.location.href = urlToGo;
            })
          }, 
          function (error) {
            $scope.status = 'Unable toget resposne ' + error;
          });

        
      };

Here, $window.location.href = urlToGo; will open a new window in mobile browser, which means user will leave my app. So, is there any technique, I can handle it inside my app using Angular or Cordova, without showing browser to him?

Smitha
  • 6,110
  • 24
  • 90
  • 161
  • Hopefully this link should help - http://stackoverflow.com/questions/36948337/angular-marked-and-inappbrowser-opening-all-links-in-the-system-browser – Gandhi May 03 '16 at 12:53

1 Answers1

1

The following Link helped me resolve this issue for my Cordova App.

Phonegap - How to open external link inside the app

Briefly from that post:

var onInApp = window.open('http://paymentpage.com', '_blank', 'location=no,hidden=yes,closebuttoncaption=Done,toolbar=no');

I did have to play with the settings dependant upon the platform to get the correct result.

The latest Cordova Docs explain it much better :

https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-inappbrowser/index.html

Hopefully this will point you in the correct direction.

Community
  • 1
  • 1
Andy Donegan
  • 782
  • 1
  • 9
  • 30