|
@@ -2,8 +2,8 @@
|
|
|
angular
|
|
|
.module('appMessages')
|
|
|
.directive('imgLoad', imgLoad);
|
|
|
- imgLoad.inject = ['$parse', '$rootScope'];
|
|
|
- function imgLoad($parse, $rootScope) {
|
|
|
+ imgLoad.inject = ['$parse', '$rootScope', '$event'];
|
|
|
+ function imgLoad($parse, $rootScope, $event) {
|
|
|
var directive = {
|
|
|
compile: compile,
|
|
|
restrict: 'A'
|
|
@@ -55,4 +55,49 @@
|
|
|
};
|
|
|
}
|
|
|
}
|
|
|
-})();
|
|
|
+})();
|
|
|
+
|
|
|
+
|
|
|
+/*
|
|
|
+ * A collection of directives that allows creation of custom event handlers that are defined as
|
|
|
+ * angular expressions and are compiled and executed within the current scope.
|
|
|
+ */
|
|
|
+// var ngEventDirectives = {};
|
|
|
+
|
|
|
+// For events that might fire synchronously during DOM manipulation
|
|
|
+// we need to execute their event handlers asynchronously using $evalAsync,
|
|
|
+// so that they are not executed in an inconsistent state.
|
|
|
+// var forceAsyncEvents = {
|
|
|
+// 'blur': true,
|
|
|
+// 'focus': true
|
|
|
+// };
|
|
|
+// forEach(
|
|
|
+// 'click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste'.split(' '),
|
|
|
+// function(eventName) {
|
|
|
+// var directiveName = directiveNormalize('ng-' + eventName);
|
|
|
+// ngEventDirectives[directiveName] = ['$parse', '$rootScope', function($parse, $rootScope) {
|
|
|
+// return {
|
|
|
+// restrict: 'A',
|
|
|
+// compile: function($element, attr) {
|
|
|
+// // NOTE:
|
|
|
+// // We expose the powerful `$event` object on the scope that provides access to the Window,
|
|
|
+// // etc. This is OK, because expressions are not sandboxed any more (and the expression
|
|
|
+// // sandbox was never meant to be a security feature anyway).
|
|
|
+// var fn = $parse(attr[directiveName]);
|
|
|
+// return function ngEventHandler(scope, element) {
|
|
|
+// element.on(eventName, function(event) {
|
|
|
+// var callback = function() {
|
|
|
+// fn(scope, {$event: event});
|
|
|
+// };
|
|
|
+// if (forceAsyncEvents[eventName] && $rootScope.$$phase) {
|
|
|
+// scope.$evalAsync(callback);
|
|
|
+// } else {
|
|
|
+// scope.$apply(callback);
|
|
|
+// }
|
|
|
+// });
|
|
|
+// };
|
|
|
+// }
|
|
|
+// };
|
|
|
+// }];
|
|
|
+// }
|
|
|
+// );
|