angularjs controller
controller('FaqCtrl', function($scope, $http)
{
$http.get("api/index.php/faq/getqusans")
.success(function (response) {
$scope.name = response.catname;
$scope.records = response.catname;
//$scope.question = response.records;
});
}).
HTML Code
<div ng-controller="FaqCtrl" class="row">
<div class="" ng-repeat="y in name">
<h3>{{ y.name }}</h3><br/>
<div class="col-md-6" ng-repeat="x in records">
<accordion close-others="true" >
<accordion-group is-open="status1.open" ng-class="{'expanded': status1.open}" >
<accordion-heading>{{ x.question }}</accordion-heading>
{{ x.answer }}
</accordion-group>
</accordion>
</div>
</div>
Json response
{
"catname": [
{
"name": "How do i 2",
"records": [
{
"question": "propose a new dish",
"answer": "Anim "
}
]
},
{
"name": "How do i 3h",
"records": [
{
"question": "supply the dishes being demanded by heartyy",
"answer": "Anim"
},
{
"question": "sdsffd",
"answer": "vcvcvcvcvcv"
}
]
}
]
}
I am not gat the question and answer print in html. only print the name is like 'How do i 2' and 'How do i 2' but name have the quection 'propose a new dish' and answer 'Anim'.