daily pastebin goal
3%
SHARE
TWEET

Untitled

a guest Jan 12th, 2018 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.     })
RAW Paste Data
Top