@@ -80,7 +80,7 @@ angular.module('angularBootstrapMaterial')
8080 replace: true,*/
8181 require : '^abmFormGroup' ,
8282 scope : {
83- type : '= '
83+ type : '@ '
8484 } ,
8585 link : function ( scope , element , attrs , formGroupCtrl ) {
8686 if ( ! formGroupCtrl ) // if used outside a form group for some reason, do nothing
@@ -96,16 +96,14 @@ angular.module('angularBootstrapMaterial')
9696angular . module ( 'angularBootstrapMaterial' )
9797 . directive ( 'abmFormControl' , [ 'isChar' , function ( isChar ) {
9898 return {
99- /*templateUrl: 'templates/input.html',
100- replace: true,*/
10199 scope : { } ,
102100 require : [ 'ngModel' , '^abmFormGroup' ] ,
103101 compile : function ( ) {
104102 return function ( $scope , $element , attrs , ctrls ) {
105103 var input = ctrls [ 0 ] ;
106104 var formGroup = ctrls [ 1 ] ;
107105 if ( ! $element . hasClass ( 'form-control' ) ) // TBD checkif the condition is unnecessary
108- $element . addClass ( 'form-control' )
106+ $element . addClass ( 'form-control' ) ;
109107 if ( ! $element . attr ( 'id' ) ) // TBD checkif the condition is unnecessary
110108 $element . attr ( 'id' , 'form-control-' + $scope . $id ) ;
111109 formGroup . registerControl ( $scope ) ;
@@ -118,17 +116,20 @@ angular.module('angularBootstrapMaterial')
118116 } )
119117 . on ( 'blur' , function ( ) {
120118 formGroup . toggleFocus ( false ) ;
121- if ( $element . val ( ) )
122- formGroup . toggleEmpty ( false ) ;
119+ formGroup . toggleEmpty ( $element . val ( ) ) ;
123120 } ) ;
124121
125122 $scope . $watch ( function ( ) {
126123 return input . $invalid ;
127124 } , formGroup . toggleError ) ;
128- $scope . $watch ( attrs . ngModel , formGroup . toggleEmpty ) ;
125+ $scope . $watch ( function ( ) {
126+ return input . $modelValue ;
127+ } , function ( newValue , oldValue ) {
128+ formGroup . toggleEmpty ( ! newValue ) ;
129+ } ) ;
129130 }
130131 }
131- }
132+ } ;
132133 } ] ) ;
133134
134135angular . module ( 'angularBootstrapMaterial' )
@@ -347,7 +348,7 @@ angular.module('angularBootstrapMaterial').factory('ripple', function () {
347348 * Make sure the user is using only one finger and then get the touch
348349 * position relative to the ripple wrapper
349350 */
350- if ( event . originalEvent ) // Do this only ifjQuery is present for some reason
351+ if ( event . originalEvent ) // Do this only if jQuery is present for some reason
351352 event = event . originalEvent
352353 if ( event . touches . length === 1 ) {
353354 return event . touches [ 0 ] . pageX - wrapperOffset . left ;
@@ -374,7 +375,7 @@ angular.module('angularBootstrapMaterial').factory('ripple', function () {
374375 * Make sure the user is using only one finger and then get the touch
375376 * position relative to the ripple wrapper
376377 */
377- if ( event . originalEvent ) // Do this only ifjQuery is present for some reason
378+ if ( event . originalEvent ) // Do this only if jQuery is present for some reason
378379 event = event . originalEvent
379380
380381 if ( event . touches . length === 1 ) {
0 commit comments