Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions acute/acute.core/acute.core.directives.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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 () {
Expand Down
2 changes: 1 addition & 1 deletion acute/acute.core/acute.core.services.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down
20 changes: 11 additions & 9 deletions acute/acute.select/acute.select.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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 };
Expand Down Expand Up @@ -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) {
Expand All @@ -890,7 +892,7 @@ angular.module("acute.select", [])
});
}
};
})
}])

.directive('acSelectOnFocus', function() {
return {
Expand Down Expand Up @@ -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') {
Expand Down