nl_tokens: @ngdoc directive @name mdInputContainer @module material . components . input
pl_tokens: function mdInputContainerDirective ( $mdTheming , $parse ) { ContainerCtrl . $inject = [ "$scope" , "$element" , "$attrs" , "$animate" ] ; var INPUT_TAGS = [ 'INPUT' , 'TEXTAREA' , 'SELECT' , 'MD-SELECT' ] ; var LEFT_SELECTORS = INPUT_TAGS . reduce ( function ( selectors , isel ) { return selectors . concat ( [ 'md-icon ~ ' + isel , '.md-icon ~ ' + isel ] ) ; } , [ ] ) . join ( "," ) ; var RIGHT_SELECTORS = INPUT_TAGS . reduce ( function ( selectors , isel ) { return selectors . concat ( [ isel + ' ~ md-icon' , isel + ' ~ .md-icon' ] ) ; } , [ ] ) . join ( "," ) ; return { restrict : 'E' , compile : compile , controller : ContainerCtrl } ; function compile ( tElement ) { // Check for both a left & right icon var leftIcon = tElement [ 0 ] . querySelector ( LEFT_SELECTORS ) ; var rightIcon = tElement [ 0 ] . querySelector ( RIGHT_SELECTORS ) ; if ( leftIcon ) { tElement . addClass ( 'md-icon-left' ) ; } if ( rightIcon ) { tElement . addClass ( 'md-icon-right' ) ; } return function postLink ( scope , element ) { $mdTheming ( element ) ; } ; } function ContainerCtrl ( $scope , $element , $attrs , $animate ) { var self = this ; self . isErrorGetter = $attrs . mdIsError && $parse ( $attrs . mdIsError ) ; self . delegateClick = function ( ) { self . <mask> . focus ( ) ; } ; self . element = $element ; self . setFocused = function ( isFocused ) { $element . toggleClass ( 'md-input-focused' , ! ! isFocused ) ; } ; self . setHasValue = function ( hasValue ) { $element . toggleClass ( 'md-input-has-value' , ! ! hasValue ) ; } ; self . setHasPlaceholder = function ( hasPlaceholder ) { $element . toggleClass ( 'md-input-has-placeholder' , ! ! hasPlaceholder ) ; } ; self . setInvalid = function ( isInvalid ) { if ( isInvalid ) { $animate . addClass ( $element , 'md-input-invalid' ) ; } else { $animate . removeClass ( $element , 'md-input-invalid' ) ; } } ; $scope . $watch ( function ( ) { return self . label && self . input ; } , function ( hasLabelAndInput ) { if ( hasLabelAndInput && ! self . label . attr ( 'for' ) ) { self . label . attr ( 'for' , self . input . attr ( 'id' ) ) ; } } ) ; } }