I have a function with the array objects.
$http({
method: 'GET',
url: 'select.php'
}).then(function success(response) {
alert(response);
//$scope.posts=response.data;
}, function error(response) {
// called asynchronously if an error occurs
// or server returns response with an error status.
}
);
function store() {
this.products = [
new product("APL", "Apple", "Eat one every…", 12, 90, 0, 2, 0, 1, 2),
new product("AVC", "Avocado", "Guacamole…", 16, 90, 0, 1, 1, 1, 2),
new product("BAN", "Banana", "These are…", 4, 120, 0, 2, 1, 2, 2)
];
}
In the above code we are passing some static data, but instead i am trying to a push some dynamic data which comes from another file as a ajax response.
so how can i make it dynamic. i have tried like this
function store() {
this.products = [
//new product("APL", "Apple", "Eat one every…", 12, 90, 0, 2, 0, 1, 2),
//new product("AVC", "Avocado", "Guacamole…", 16, 90, 0, 1, 1, 1, 2),
//new product("BAN", "Banana", "These are…", 4, 120, 0, 2, 1, 2, 2)
$scope.product.push(response.data);
];
}
but its not working. any idea how can i make it?