function stationMenu($scope){
$.ajax({
url: "/users/station_names_ajax",
type: "POST",
success: function(data){
$scope.phones = [
{"name": "Nexus S",
"snippet": "Fast just got faster with Nexus S."},
{"name": "Motorola XOOM™ with Wi-Fi",
"snippet": "The Next, Next Generation tablet."},
{"name": "MOTOROLA XOOM™",
"snippet": "The Next, Next Generation tablet."}
];
//console.log(Stations);
}
});
// $scope.phones = Stations;
// console.log(Stations);
}
where as if I do this
function stationMenu($scope){
$scope.phones = [
{"name": "Nexus S",
"snippet": "Fast just got faster with Nexus S."},
{"name": "Motorola XOOM™ with Wi-Fi",
"snippet": "The Next, Next Generation tablet."},
{"name": "MOTOROLA XOOM™",
"snippet": "The Next, Next Generation tablet."}
];
}
it works….how can I make it work within ajax
Use the when, then construct to work with the data returned from the server.