Ionic Open external function in Ionic popup


#1

I include FB account kit login with sms in my project. When I test my Ionic app in browser, on button click the fb popup opens, but when I try to test it in Ionic View app on my phone the popup wont show on button click?why?And can I include external function in ionic popup?
Here is my controller on button click:
> .controller(‘RegistrationCtrl’, function($scope, $http, $ionicModal) {

          $scope.loginWithSMS = function($scope, $ionicPopup) {
         AccountKit.login("PHONE",{}, loginCallback);
          function loginCallback(response) {
                  console.log(response);
                  if (response.status === "PARTIALLY_AUTHENTICATED") {
                    document.getElementById("code").value = response.code;
                    document.getElementById("csrf_nonce").value = response.state;
                    document.getElementById("my_form").submit();
                  }
                  else if (response.status === "NOT_AUTHENTICATED") {    
                  }
                  else if (response.status === "BAD_PARAMS") {                
                  }
                }
          }
        $scope.submit = function($scope, $ionicPopup){
            $scope.data = {};
            $http.post(app4travel.apiUrl + '/register_mobile')
              .success(function(response, status, headers, config) {
                console.warn('Sent')
                console.warn(response)
                console.warn(status)
                $scope.response = response.data;
            })
        }
    })