Is it possible to access MySQL databases in Angular framework or would that be insecure like other Javascript and I will need to post to a PHP page to retrieve data/json>
// Application module
var dbApp = angular.module('dbApp',[]);
dbApp.controller("DbController",['$scope','$http', function($scope,$http){
// Function to get data from the database
getDatafromDatabase();
function getDatafromDatabase(){
// Sending request to php files
$http.post('databaseFiles/yourfile.php').success(function(data){
// Stored the returned data into scope
$scope.dbData = data;
});
}
And php file which we want to call in angularjs script (yourfile.php)
HTML file look like this
...
...
Column1
Column2
Column3
Column4
Column5
{{dbData .Column1}}
{{dbData .Column2}}
{{dbData .Column3}}
{{dbData .Column4}}
{{dbData .Column5}}
I hope it helps you