Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to hit MySql queries by using Angular JS

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 286
    Comment on it

    Hello Readers If you want to hit the MySql queries from another page by your current page, The by using Angular js you can do this. Also angular js will offers you to show your records in a pre formated desing. Let's see the example as below:-

      <!DOCTYPE html>
        <html >
        </style>
        <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
        <body> 
        <div ng-app="myApp" ng-controller="StudentID"> 
        <table>
          <tr ng-repeat="x in names">
            <td>{{ x.School}}</td>
            <td>{{ x.City}}</td>
          </tr>
        </table> 
        </div>
        <script>
        var app = angular.module('myApp', []);
        app.controller('StudentID', function($scope, $http) {
           $http.get("www.ururl/file/mysql.php")
           .then(function (response) {$scope.names = response.data.records;});
        });
        </script> 
        </body>
        </html>
    

    Now in above code you just have to sepcify the page where mysql query is written. And its result will be shown in your current page.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: