-
Notifications
You must be signed in to change notification settings - Fork 1
/
feedTest.html
69 lines (52 loc) · 2.02 KB
/
feedTest.html
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-resource.min.js"></script>
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script>
var myApp = angular.module("myApp", []);
myApp.service('myservice', ['$http', '$q', function ($http, $q) {
var entries = [];
function getData(){
var arr1 = [];
var BlogFeeds = "//www.blogger.com/feeds/7833828309523986982/posts/default?start-index=0001&max-results=10&alt=json&callback=JSON_CALLBACK";
$http.jsonp(BlogFeeds)
.success(function(data){
angular.forEach(data.feed.entry, function(entryX){
arr1.push(entryX);
});
angular.copy(arr1, entries);
})
.error(function (data) {
$scope.data = "Request failed";
});
}
return {
getData: getData,
entries: entries
};
}]);
myApp.controller('picCtrl', function ($scope, myservice) {
$scope.message = "Welcome";
$scope.entries = myservice.entries;
myservice.getData();
});
</script>
</head>
<body>
<div ng-app="myApp">
<div ng-controller="picCtrl">
{{message}}
<span ng-repeat="entry in entries">
<span >
<img ng-src="{{entry.media$thumbnail.url}}" />
{{entry.title.$t}}
</span>
</span>
</div>
</div>
</body>
</html>
<!-- http://stackoverflow.com/questions/24417749/angularjs-scope-not-binding-data-in-ng-repeat -->