I have this php array that has different years in it:
array(6) { [0]=> int(2017) [1]=> int(2016) [2]=> int(2015) [3]=> int(2014) [4]=> int(2013) [5]=> int(2012) }
And I want to pass it to a structure that I can use in angularjs, like this:
$scope.miarray = response.data;
To then be able to iterate with ng-repeat in a view and generate a selector with classic html options, with the years to choose from.
Take the array and re-encode it with json_encode()
, get:
string(97) "[{"scalar":2017},{"scalar":2016},{"scalar":2015},{"scalar":2014},{"scalar":2013},{"scalar":2012}]" pero en la vista, por consola, obtengo "message": "Undefined offset: 0",
I will appreciate help in this regard, Thank you!