This is an angularjs function that retrieves specific categories.
$scope.getSpecificCat = function(p_cat) {
$http.get(url+'getSpecificCatJson/' + p_cat).success(function(data){
$scope.specifics = data;
}).error(function(){
//alert('there is some errror while fetching product ');
});
}
The specifics contain two arrays like [Array[2],Array[2]]
. I am trying to find a way to display the values of these arrays in ng-repeat
. The first array contains data like 0:object with product_name:"tv", while the second array has 0:"30". This is an excerpt from my modal function:
{
$current_date = date('d-M-Y');
$current_new = strtotime($current_date);
$this->db->select("*, ((p_bid/total_bid)*100) as progress");
// print_r($current_new);die;
$this->db->where('p_cat',$p_cat);
$this->db->where('p_status','active');
$query = $this->db->get('product');
$data = $query->result();
$percent_array =[];
foreach ($data as $row) {
$id = $row->p_id;
$ppr = $row->pp_date;
$pcr = $row->pc_date;
$ppn = strtotime($ppr);
$pcn = strtotime($pcr);
$p_name = $row->p_name;
if($row->p_cat == 'diamond')
{
return $data;
}
else if($row->p_cat == 'gold' && $ppr < 1)
{
return $data ;
}
else if(!empty($pcn && $ppn) && $pcn != $ppn)
{
$percent_array[] = (($current_new-$ppn) * 100)/($pcn-$ppn);
// $percent_data = array('0' => $percent_array , );
}
}
$percent_data = array('0' =>$data, '1' => $percent_array);
return $percent_data;
}
I want to display both the percentage and the data for use in ng-repeat.