Php 如何在codeigniter中以angularjs显示来自2个联接表的数据?
我需要从用户表中获取用户id、firstname、lastname,并从反馈表中获取反馈id、注释、用户id和配方id,其中来自用户的用户id等于用户表中的用户id Review.htmlPhp 如何在codeigniter中以angularjs显示来自2个联接表的数据?,php,angularjs,codeigniter,Php,Angularjs,Codeigniter,我需要从用户表中获取用户id、firstname、lastname,并从反馈表中获取反馈id、注释、用户id和配方id,其中来自用户的用户id等于用户表中的用户id Review.html <div class="items item item-avatar" ng-repeat="comment in feedbackdata"> <img src="img/asd.jpg"> <h2>{{comment.firstname}} {{commen
<div class="items item item-avatar" ng-repeat="comment in feedbackdata">
<img src="img/asd.jpg">
<h2>{{comment.firstname}} {{comment.lastname}}</h2>// I don't know what to put here
<p>{{comment.feedback_id}}</p>
<p>{{comment.comment}}</p>
<p>{{comment.user_id}}</p>
<p>{{comment.recipe_id}}</p>
Service.js
.factory('getFeedbackService', function($http){
return {
all: function() {
return $http.get("http://localhost/admin-recipick/api/Main/get_feedback_data");
}
};
});
main.php
public function get_feedback_data()
{
$postdata = json_decode(file_get_contents("php://input"));
$feedback = $this->User_model->feedback_data();
echo json_encode($feedback);
}
user_model.php
public function feedback_data()
{
$this->db->select('*');
$this->db->from('feedback')
$this->db->join('user','user.user_id = feedback.user_id');
$query = $this->db->get();
return $query->result_array();
}
问题是什么?如何在angular js中显示反馈id、用户id、名字、姓氏和评论?但这不是一个可行的问题。我们不知道这其中的哪一部分起作用或不起作用。概述您对疑难解答所做的操作我尝试只显示一个表中的数据,并且效果良好。我不知道从两个连接的表中获取和显示数据时该怎么办。我需要弄清楚如何将数据绑定到两个连接的表中
public function feedback_data()
{
$this->db->select('*');
$this->db->from('feedback')
$this->db->join('user','user.user_id = feedback.user_id');
$query = $this->db->get();
return $query->result_array();
}