Php 如何在ionic中从一个视图到另一个视图获取数据?

Php 如何在ionic中从一个视图到另一个视图获取数据?,php,angularjs,ajax,codeigniter,ionic-framework,Php,Angularjs,Ajax,Codeigniter,Ionic Framework,我遵循了这个教程 关于如何从数据库中检索数据并在ionic中显示,但问题是数据只能在一个视图中看到,我不知道如何在另一个视图中查看 -我已成功显示数据库中的ionic配方,当我单击钢笔图标时,它应显示配方名称、成分等 -但当我点击它时,它不会显示任何数据 以下是我查看数据的代码: user_model.php(codeigniter-model) Main.php(codeigniter-controller) RecipeService.js(离子型) .factory('getRecipeS

我遵循了这个教程 关于如何从数据库中检索数据并在ionic中显示,但问题是数据只能在一个视图中看到,我不知道如何在另一个视图中查看

-我已成功显示数据库中的ionic配方,当我单击钢笔图标时,它应显示配方名称、成分等

-但当我点击它时,它不会显示任何数据

以下是我查看数据的代码:

user_model.php(codeigniter-model)

Main.php(codeigniter-controller)

RecipeService.js(离子型)

.factory('getRecipeService',函数($http){

profile.html(离子型)


{{recipe.Recipename}
{{配方.配料}

删除
recipe-detail.html(爱奥尼亚-在这个html中,我也想在这里显示数据,但它在输入类型中没有显示数据。我该怎么办?)


索引名
配方名
成分
烹饪时间
20分钟
30分钟
1小时
更新配方

对控制器使用http

.controller('Ctrl', function($scope, $http, $stateParams) {
$scope.userrecipedata = [];

$http.get('http://localhost/admin-recipick/api/Main/get_user_recipe_data').success(function(response){
    $scope.userrecipedata = response;
}); 
})

它可以运行sir@B.Nadesh kumar,但我想从另一个视图编辑数据,即recipe-detail.html,我该怎么做?使用此链接发布到codeigniter
public function get_user_recipe_data()
{
    $postdata = json_decode(file_get_contents("php://input"));
    $user_recipe = $this->User_model->user_recipe_data();
    echo json_encode($user_recipe);
}
return {
    all: function() {
      return $http.get("http://localhost/admin-recipick/api/Main/get_user_recipe_data");
    },
    get: function(Recipe_ID) {
        q = $http.get("http://localhost/admin-recipick/api/Main/get_user_recipe_data");
  for (var i = 0; i < q.length; i++) {
    if (q[i].id === parseInt(Recipe_ID)) {
      return q[i];
    }
  }
  return null;
}
};
 getRecipeService.all().then(function(payload) {
 $scope.userrecipedata = payload.data;
 console.log(payload);
});
 <ion-list>
              <ion-item ng-repeat="recipe in userrecipedata" class="item-remove-animate item-avatar item-icon-right"  type="item-textu-wrap" href="#/app/recipes/{{recipe.Recipe_ID}}">
                <img ng-src="img/food/porkmenudo.jpg">

                <h2>{{recipe.Recipename}}</h2>
                <p>{{recipe.Ingredients}}</p>
                <i class="icon ion-edit"></i>
                <ion-option-button class="button-assertive" ng-click="remove(recipe)">
                  Delete
                </ion-option-button>
              </ion-item>
            </ion-list>
    <div class="list">

        <label class="item item-input">
          <span class="input-label">Index Name</span>
            <input type="text" ng-model="recipe.Recipe_ID">
        </label>
        <label class="item item-input">
           <span class="input-label">Recipe Name</span>
             <input type="text" ng-model="recipe.Recipename">
         </label>
         <label class="item item-input">
            <span class="input-label">Ingredients</span>
              <input type="text" ng-model="recipe.Ingredients">
         </label>
         <label class="item item-input item-select">
            <span class="input-label">Cooking Time</span>
              <select ng-model="recipe.Cookingtime">
                 <option value="20mins">20mins</option>
                 <option value="30mins">30mins</option>
                 <option value="1hr">1hr</option>
               </select>
          </label>
          <label class="item item-input">
              <textarea placeholder="PROCEDURE" rows="12" ng-model="recipe.Procedure">
              </textarea>
          </label>
           <button class="button button-block button-assertive h1" ng-click="AddRecipe()">Update Recipe</button>
          </div>
.controller('Ctrl', function($scope, $http, $stateParams) {
$scope.userrecipedata = [];

$http.get('http://localhost/admin-recipick/api/Main/get_user_recipe_data').success(function(response){
    $scope.userrecipedata = response;
}); 
})