小编Gir*_*ulu的帖子

Ionic - 应用程序可以在浏览器中运行,但在移动设备中模拟时无法运行

我已经尝试过这段代码

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:'http://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";
    })
}
}])
Run Code Online (Sandbox Code Playgroud)

我的后端 php 代码

<?php 
header('Access-Control-Allow-Origin: *' );
    header('Access-Control-Allow-Credentials: true' );
    header('Access-Control-Request-Method: *');
    header('Access-Control-Allow-Methods: POST, …
Run Code Online (Sandbox Code Playgroud)

php android json angularjs ionic-framework

2
推荐指数
1
解决办法
4691
查看次数

标签 统计

android ×1

angularjs ×1

ionic-framework ×1

json ×1

php ×1