阅读背景:

Ionic - app可以在浏览器中工作,但在移动设备中模拟时不能工作

来源:互联网 

I have tried this code

我试过这段代码。

angular.module('starter', ['ionic','ngCordova'])
.run(function($ionicPlatform) {
 $ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if(window.cordova && window.cordova.plugins.Keyboard) {
  cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
  StatusBar.styleDefault();
}
});
})
.controller('datactr',['$scope','$http',function($scope,$http) {
$scope.submit=function(){
          console.log("step1");

    $http({
      method:'POST',
      url:'https://awesomeg.2fh.co/updata.php',
      crossDomain : true,
      data:{
        'name':$scope.name,
      }

    }).success(function(data,status,header,config){
      console.log("step2");
      console.log(data);
      $scope.name="";
      $scope.message="You have successfully updated the database";
    })
}
}])
angular.mod



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: