Skip to content

Commit 44b23d6

Browse files
author
Mariana Ramos
authored
Merge pull request #26 from takenet/feature/blip_input_invalid_property
'invalid' property on blip input
2 parents 76fadcf + 6bbb7f3 commit 44b23d6

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/components/blipInputDpr/blipInputDpr.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const BLIP_INPUT_PREFIX = 'blip-input-dpr';
2424
* @param {string} type - the input type is necessary for validation. If not specified, takes value 'text'
2525
* @param {string} inputAutocomplete - the input autocomplete field for undesired browser autompletes
2626
* @param {string} unmaskablePassword - the expression that defines if input of type password will be unmaskable
27+
* @param {expression} invalid - the input is invalid
2728
*/
2829

2930
class BlipInputDprController extends ComponentController {
@@ -33,6 +34,7 @@ class BlipInputDprController extends ComponentController {
3334
passwordUnmasked: boolean = false;
3435
onChange: ($val) => {};
3536
disabled: boolean;
37+
invalid: boolean;
3638

3739
constructor(
3840
private $element,
@@ -91,6 +93,7 @@ export const BlipInputDprComponent = angular
9193
fieldId: '@?',
9294
showPasswordStrength: '<?',
9395
unmaskablePassword: '<?',
96+
invalid: '<?'
9497
},
9598
require: {
9699
ngModel: 'ngModel',

src/components/blipInputDpr/blipInputDprView.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
ng-class="{
33
'bp-input-wrapper--focus': focused,
44
'bp-input-wrapper--valid': focused && $ctrl.parentForm[$ctrl.fieldName].$viewValue && $ctrl.parentForm[$ctrl.fieldName].$valid,
5-
'bp-input-wrapper--invalid': !$ctrl.disabled && !$ctrl.parentForm[$ctrl.fieldName].$pristine && $ctrl.parentForm[$ctrl.fieldName].$invalid,
5+
'bp-input-wrapper--invalid': $ctrl.invalid || (!$ctrl.disabled && !$ctrl.parentForm[$ctrl.fieldName].$pristine && $ctrl.parentForm[$ctrl.fieldName].$invalid),
66
'bp-input-wrapper--disabled': $ctrl.disabled }"
77
ng-click="$ctrl.focus()"
88
id="{{$ctrl.elementId}}">
@@ -11,7 +11,7 @@
1111
'bp-c-rooftop': !focused,
1212
'bp-c-blip-dark': focused,
1313
'bp-c-true': focused && $ctrl.parentForm[$ctrl.fieldName].$viewValue && $ctrl.parentForm[$ctrl.fieldName].$valid,
14-
'bp-c-warning': !$ctrl.parentForm[$ctrl.fieldName].$pristine && $ctrl.parentForm[$ctrl.fieldName].$invalid }">{{$ctrl.label}}</label>
14+
'bp-c-warning': $ctrl.invalid || (!$ctrl.parentForm[$ctrl.fieldName].$pristine && $ctrl.parentForm[$ctrl.fieldName].$invalid) }">{{$ctrl.label}}</label>
1515

1616
<password-strength ng-if="$ctrl.showPasswordStrength && $ctrl.type === 'password'" ng-model="$ctrl.model"></password-strength>
1717

0 commit comments

Comments
 (0)