nice-elements 1.8.7 → 1.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +1 -1
- package/bower.json +1 -1
- package/dist/nice.js +12 -2
- package/dist/nice.min.js +1 -1
- package/package.json +1 -1
- package/src/components/nice-input/nice-input.js +11 -1
- package/src/services/nice-service.js +1 -1
package/package.json
CHANGED
|
@@ -33,7 +33,8 @@ angular.module('niceElements')
|
|
|
33
33
|
tabIndex: '@',
|
|
34
34
|
isFocused: '@',
|
|
35
35
|
isInline: '=',
|
|
36
|
-
onChange: '&?'
|
|
36
|
+
onChange: '&?',
|
|
37
|
+
numbersOnly: '=', // Allow only numbers in the input
|
|
37
38
|
},
|
|
38
39
|
|
|
39
40
|
link: function (scope, element, attrs) {
|
|
@@ -129,6 +130,15 @@ angular.module('niceElements')
|
|
|
129
130
|
$scope.id = Math.random().toString(36).substring(7);
|
|
130
131
|
|
|
131
132
|
$scope.keypress = function (event) {
|
|
133
|
+
if ($scope.numbersOnly) {
|
|
134
|
+
if ((event.charCode >= 48 && event.charCode <= 58) || event.charCode == 0) { // Allow only numbers
|
|
135
|
+
return true;
|
|
136
|
+
} else { // Prevent everything else
|
|
137
|
+
event.preventDefault();
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
132
142
|
if ($scope.type == "number" || $scope.type == "integer") {
|
|
133
143
|
if (event.charCode == 46 || event.charCode == 44) { // Handle "." and "," key (only one allowed)
|
|
134
144
|
if ($scope.type == "number") {
|