I have a query in angular. I need to access the data of a json
[
{
"gift": [
{
"description": "Recibe un pichel de te gratis!!",
"name": "Te para Todos",
"cod": "Te01",
"poll": 6,
"id": 5
}
],
"question": [
{
"header": "Que tan seguido viene a nuestro local?",
"poll": 6,
"id": 16
},
{
"header": "quisiera mas promociones?",
"poll": 6,
"id": 17
}
],
"name": "PH01",
"id": 6
}
]
mainly I do not know how to access the header within question, the amount of question is variable in all queries. my model is this:
angular.module( 'pollmodel', [] )
.factory( 'Poll', function () {
function Poll( name, ) {
}
Poll.build = function ( data ) {
if( !data ) {
return null;
}
return new Poll( data.name )
}
Poll.prototype.toJson = function () {
return angular.toJson( this );
};
Poll.fromJsonBunch = function ( data ) {
if( angular.isArray( data ) ) {
return data.map( film.build ).filter( boolean );
}
return film.build( data );
}
return Poll;
} )
is incomplete. because I have not known how to complete it so that it properly receives the json.