angularjs - How can set a script to run after all photos have loaded? -
i have have spent hours trying of different methods given online nothing works. want load script run after images have loaded. there angular won't allow me this? i'm using $routeprovider
:
var photos = { name: 'photos', url: '/photos', views: { main: { templateurl: "views/photos/photos.html", controller: function($scope,$http){ $http({ url: 'get/photos', method: "post" }) .success(function (data, status, headers, config) { $scope.data = data; // doesn't work $(window).load(function() { myscript(); }); }) .error(function (data, status, headers, config) { $scope.status = status; }); } } } };
by way, i'm not getting errors in console.
it seems me http post call retrieves photos. , suppose myscript
function. why not try this:
var photos = { name: 'photos', url: '/photos', views: { main: { templateurl: "views/photos/photos.html", controller: function($scope,$http){ $http({ url: 'get/photos', method: "post" }) .success(function (data, status, headers, config) { $scope.data = data; myscript(); }) .error(function (data, status, headers, config) { $scope.status = status; }); } } } };
since myscript
function runs after post
succeeds. supposing data
refers actual image data.
Comments
Post a Comment