23 lines
718 B
HTML
23 lines
718 B
HTML
<html>
|
|
<head>
|
|
<script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
|
|
<script src="php_crud_api_transform.js"></script>
|
|
<script>
|
|
var app = angular.module('myApplication', []);
|
|
app.controller('postController', function($scope, $http) {
|
|
$http.post("http://localhost/api.php/posts",{user_id:1,category_id:1,content:"from angular"});
|
|
$http.get("http://localhost/api.php/posts")
|
|
.success(function(response) { $scope.posts = php_crud_api_transform(response).posts; });
|
|
});
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div ng-app="myApplication" ng-controller="postController">
|
|
<ul>
|
|
<li ng-repeat="x in posts">
|
|
{{ x.id + ', ' + x.content }}
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html>
|