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..c92a638 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", @@ -585,14 +585,16 @@ angular.module("acute.select", []) if ($scope.settings.allowCustomText && !$scope.matchFound) { customText = $scope.searchText; if (customText.length > 0) { - // Create new data item - dataItem = {}; - dataItem[$scope.textField] = customText; - // add the key field if it is defined. if ($scope.keyField) { + // Create new data item + dataItem = {}; dataItem[$scope.keyField] = customText; } + // set data item to custom text. + else { + dataItem = customText; + } $scope.modelUpdating = true; $scope.model = dataItem; $scope.confirmedItem = $scope.selectedItem = { "text": customText, "value": dataItem, "index": -1 }; @@ -868,10 +870,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 +892,7 @@ angular.module("acute.select", []) }); } }; -}) +}]) .directive('acSelectOnFocus', function() { return { @@ -965,7 +967,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') {