From d84c5d7fa5739f699d1be826f74f8e0bac43ae0f Mon Sep 17 00:00:00 2001 From: jihgao Date: Thu, 29 Jan 2015 13:59:52 +0800 Subject: [PATCH] Fixed the dependencies of directive Changed the way for injecting the dependencies when write the directives to fix the issue that happens when comprising this javascript --- acute/acute.core/acute.core.directives.js | 4 ++-- acute/acute.core/acute.core.services.js | 2 +- acute/acute.select/acute.select.js | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/acute/acute.core/acute.core.directives.js b/acute/acute.core/acute.core.directives.js index 65433eb..2e9ed8a 100644 --- a/acute/acute.core/acute.core.directives.js +++ b/acute/acute.core/acute.core.directives.js @@ -1,6 +1,6 @@ angular.module("acute.core.directives", []) // Directive to set focus to an element when a specified expression is true -.directive('acuteFocus', function ($timeout, $parse) { +.directive('acuteFocus', ["$timeout", "$parse", function ($timeout, $parse) { return { restrict: "A", link: function (scope, element, attributes) { @@ -19,7 +19,7 @@ }); } }; -}) +}]) // Directive for a scroll container. Set acute-scroll-top to an expression and the div will scroll when it changes .directive('acScrollTo', function () { diff --git a/acute/acute.core/acute.core.services.js b/acute/acute.core/acute.core.services.js index b13958d..f70c987 100644 --- a/acute/acute.core/acute.core.services.js +++ b/acute/acute.core/acute.core.services.js @@ -2,7 +2,7 @@ angular.module("acute.core.services", []) // safeApply service, courtesy Alex Vanston and Andrew Reutter -.factory('safeApply', [function ($rootScope) { +.factory('safeApply', ['$rootScope', function ($rootScope) { return function ($scope, fn) { var phase = $scope.$root.$$phase; if (phase == '$apply' || phase == '$digest') { diff --git a/acute/acute.select/acute.select.js b/acute/acute.select/acute.select.js index 74225b9..47c99c9 100644 --- a/acute/acute.select/acute.select.js +++ b/acute/acute.select/acute.select.js @@ -11,7 +11,7 @@ // Note:- ac-options works like ng-options, but does not support option groups angular.module("acute.select", []) -.directive("acSelect", function($parse, acuteSelectService) { +.directive("acSelect", ["$parse", "acuteSelectService", function($parse, acuteSelectService) { var defaultSettings = acuteSelectService.getSettings(); return { restrict: "EAC", @@ -868,10 +868,10 @@ angular.module("acute.select", []) } } }; -}) +}]) // Directive to set focus to an element when a specified expression is true -.directive('acFocus', function($timeout, $parse, safeApply) { +.directive('acFocus', ["$timeout", "$parse", "safeApply", function($timeout, $parse, safeApply) { return { restrict: "A", link: function(scope, element, attributes) { @@ -890,7 +890,7 @@ angular.module("acute.select", []) }); } }; -}) +}]) .directive('acSelectOnFocus', function() { return { @@ -965,7 +965,7 @@ angular.module("acute.select", []) }) // safeApply service, courtesy Alex Vanston and Andrew Reutter -.factory('safeApply', [function($rootScope) { +.factory('safeApply', ['$rootScope', function($rootScope) { return function($scope, fn) { var phase = $scope.$root.$$phase; if (phase == '$apply' || phase == '$digest') {