quiz

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<div ng-app="myApp" ng-controller="myCtrl">

    <p>Today's welcome message is:</p>
    <h1>{{myWelcome}}</h1>

</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<script>
    var app = angular.module('myApp', []);
    app.controller('myCtrl', function($scope, $http) {
        var url = "http://localhost:80/slimphp/public/api/quiz";
        $http.get(url)
            .then(function(response) {
                $scope.myWelcome = response.data;
            });
    });
</script>
<script src="js/app.js"></script>
</body>

</html>

//The below code will read the data from student.json file and will pass to the $scope variablemyAppModule.controller("categoryController", function($scope, $http){
    var url = "http://localhost:80/slimphp/public/api/quiz";
    $http.get(url) //reading the student.json file
        .success (function(data){
            $scope.categories = data; // binding the data to the $scope variable        })
        .error(function(data, status) {
            console.error('failure loading the student record', status, data);
            $scope.categories = { }; //return blank record if something goes wrong        });
} );//end controller

Comments

Popular posts from this blog

url

Studnet Fetch Data Photo and Detail

service passing