|
@@ -5,20 +5,21 @@
|
5
|
5
|
<script>
|
6
|
6
|
var app = angular.module('myApplication', []);
|
7
|
7
|
app.controller('postController', function($scope, $http) {
|
8
|
|
- var url = '../api.php/posts';
|
9
|
|
- $http.post(url,{user_id:1,category_id:1,content:"from angular"}).success(function(){
|
10
|
|
- $http.get(url).success(function(response){
|
11
|
|
- $scope.posts = php_crud_api_transform(response).posts;
|
12
|
|
- });
|
13
|
|
- });
|
|
8
|
+ var url = '../api.php/posts';
|
|
9
|
+ $http.post(url, {user_id: 1, category_id: 1, content: "from angular"}).success(function() {
|
|
10
|
+ $http.get(url).success(function(response) {
|
|
11
|
+ $scope.posts = php_crud_api_transform(response).posts;
|
|
12
|
+ });
|
|
13
|
+ });
|
14
|
14
|
});
|
15
|
15
|
</script>
|
16
|
16
|
</head>
|
17
|
17
|
<body>
|
18
|
18
|
<div ng-app="myApplication" ng-controller="postController">
|
19
|
|
- <ul>
|
20
|
|
- <li ng-repeat="x in posts">{{ x.id + ', ' + x.content }}</li>
|
21
|
|
- </ul>
|
|
19
|
+ <ul>
|
|
20
|
+ <li ng-repeat="x in posts">{{ x.id + ', ' + x.content }}</li>
|
|
21
|
+ </ul>
|
22
|
22
|
</div>
|
23
|
23
|
</body>
|
24
|
24
|
</html>
|
|
25
|
+
|