hi i am new to angular js ,i want to fetch mysql data from tabel this is my controller define in finalOrder.js file i have also include my tst.php file with this code.the problem is that its not returning any value. please help me with this coding ,thank you in advance.
(function(){
angular
.module('ecoms')
.controller('finalOrder',finalControler);
function finalControler ($http){
var vm = this;
vm.value1 = 'one';
vm.value2 = 'two';
vm.testfun = testfun;
function testfun($http){alert("in controller");
$http.get("tst.php")
.success(function(data){
alert(data);
});
// var chkval2 = document.getElementById('rad1').value;
if (document.getElementById('r1').checked) {
var chkval1 = document.getElementById('r1').value;
}
if (document.getElementById('r2').checked) {
var chkval1 = document.getElementById('r2').value;
}
//alert(chkval1);
switch (chkval1) {
case 'one':
alert(chkval1);
break;
case 'two':
alert(chkval1);
break;
}
}
}
})();
and this is my tst.php file
include("db_config.php");
$query = $db->query("SELECT * FROM customer_shipping where Customer_ID=1");
$output = array();
if($query->num_rows > 0){
while($row = $query->fetch_assoc()){
$output[] = $row;
}
echo json_decode($output);
}
?>