JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-app="Example">
<div ng-controller="TestController">
<ul>
<li ng-repeat="item in list"> <span>{{item.name}}</span>
<button ng-click="add(item)">Add</button>
<ul ng-show="item.children">
<li ng-repeat="child in item.children"> <span>{{child.name}}</span>
</li>
</ul>
</li>
</ul>
</div>
</div>
JavaScript
angular.module('Example', [])
.factory('VkApiService', function ($http) {
var VkApiService = {
GetPhoto: function () {
var url = 'http://api.vk.com/method/photos.search?count=250&lat=56.30062247818159&long=43.932149574035634&radius=800&sort=0&callback=JSON_CALLBACK&_=1402513614373';
var promise = $http.jsonp(url).success(function (data) {
console.log(data);
});
return promise;
}
};
return VkApiService;
})
.controller('TestController', ['VkApiService', function (VkApiService) {
var self = this;
this.getPhotos = function () {
VkApiService.GetPhoto().then(function (response) {
console.log("ss");
});
}
this.getPhotos();
}]);