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>
    <table class="table table-condensed">
        <thead>
        <tr>
            <th>Question</th>
            <th>choice 1</th>
            <th>choice 2</th>
            <th>choice 3</th>
            <th>choice 4</th>
            <th>answer</th>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="user in users">
            <td>{{user.question}}</td>
            <td>{{user.choice1}}</td>
            <td>{{user.choice2}}</td>
            <td>{{user.choice3}}</td>
            <td>{{user.choice4}}</td>
            <td>{{user.answer}}</td>

            <td><a href="#/edit/{{user.id}}" class="btn btn-default btn-sm"><i class="glyphicon glyphicon-pencil"></i></button></td>
        </tr>
        </tbody>
    </table>
    <a class="btn btn-primary" href="#/add-user">Add New User</a>

</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.users = response.data;
            });
    });
</script>
<script src="js/app.js"></script>
</body>

</html>


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.users = response.data[0];
            console.log($scope.users);

        });
    //  $.each(data[0], function(i, users) { data[0][i].id + data[0][i].question + data[0][i].choice1 + data[0][i].choice2  });
});



<!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>
  <table class="table table-condensed">
    <thead>
    <tr>
      <th>Question Number</th>
      <th>Question</th>
      <th>choice 1</th>
      <th>choice 2</th>
      <th>choice 3</th>
      <th>choice 4</th>
      <th>answer</th>
    </tr>
    </thead>
    <tbody>
    <tr>
      <td>{{users.id}}</td>
      <td>{{users.question}}</td>
      <td>{{users.choice1}}</td>
      <td>{{users.choice2}}</td>
      <td>{{users.choice3}}</td>
      <td>{{users.choice4}}</td>
      <td>{{users.answer}}</td>

      <td><a href="#/edit/{{users.id}}" class="btn btn-default btn-sm"><i class="glyphicon glyphicon-pencil"></i></button></td>
    </tr>
    </tbody>
  </table>
  <a class="btn btn-primary" href="#/add-user">Add New User</a>

</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<script src="../js/app.js"></script>
</body>

</html>



<!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>
  <table class="table table-condensed">
    <thead>
    <tr>
      <th>Question</th>
      <th>choice 1</th>
      <th>choice 2</th>
      <th>choice 3</th>
      <th>choice 4</th>
      <th>answer</th>
    </tr>
    </thead>
    <tbody>
    <tr ng-repeat="user in users">
      <td>{{user.question}}</td>
      <td>{{user.choice1}}</td>
      <td>{{user.choice2}}</td>
      <td>{{user.choice3}}</td>
      <td>{{user.choice4}}</td>
      <td>{{user.answer}}</td>

      <td><a href="#/edit/{{user.id}}" class="btn btn-default btn-sm"><i class="glyphicon glyphicon-pencil"></i></button></td>
    </tr>
    </tbody>
  </table>
  <a class="btn btn-primary" href="#/add-user">Add New User</a>

</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.users = response.data;
                console.log(response.data);
            });

        console.log($scope.users);
      //  $.each(data[0], function(i, users) { data[0][i].id + data[0][i].question + data[0][i].choice1 + data[0][i].choice2  });
    });
</script>
<script src="js/app.js"></script>
</body>

</html>


Comments

Popular posts from this blog

url

Studnet Fetch Data Photo and Detail

service passing