Guest User

Untitled

a guest
Jan 12th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. angular.module("fb_totem")
  2. .controller('mycontroller', function($scope){
  3. $scope.loading=true;
  4.  
  5. $scope.ImgLoaded=function(val){
  6. $scope.loading=false;
  7. }
  8. })
  9.  
  10. <img image-on-load="ImgLoaded" ngf-humbnail="url_mobilePhoto"/>
  11. <button type="button" ng-click="cancel()" ng-disabled="loading"</button>
  12.  
  13. angular.module("fb_totem")
  14. .directive('imageOnLoad', function() {
  15. return {
  16. restrict: 'A',
  17. link: function(scope, element, attrs) {
  18. element.bind('load', function() {
  19. scope.$apply(attrs.imageOnLoad)(true);
  20. });
  21. element.bind('error', function(){
  22. scope.$apply(attrs.imageOnLoad)(false);
  23. });
  24. }
  25. };
  26. })
Add Comment
Please, Sign In to add comment