forked from dropej/IC
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
30 lines (27 loc) · 857 Bytes
/
app.js
File metadata and controls
30 lines (27 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// initialize the app
var myapp = angular.module('icApp', []);
// set the configuration
myapp.run(['$rootScope', function($rootScope){
// the following data is fetched from the JavaScript variables created by wp_localize_script(), and stored in the Angular rootScope
$rootScope.dir = BlogInfo.url;
$rootScope.site = BlogInfo.site;
$rootScope.api = AppAPI.url;
}]);
// add a controller
myapp.controller('myController', ['$scope', '$http', function($scope, $http) {
// prueba de Pedro
$scope.title = 'Iglesia Cristiana';
// load posts from the WordPress API
$http({
method: 'GET',
url: $scope.api, // derived from the rootScope
params: {
json: 'get_posts'
}
}).
success(function(data, status, headers, config) {
$scope.postdata = data.posts;
}).
error(function(data, status, headers, config) {
});
}]);