2016-03-02 171 views
0

有沒有什麼辦法可以處理角度材質md-autocomplete標籤的類輸入? 喜歡的東西:有角度的材質md-input-class

<input flex="" type="search" id="search" name="" class="form-control input-form"> 

雖然我現在有這個,當我產生我的MD-自動完成:

<input flex="" type="search" id="search" name="" ng-if="!floatingLabel" autocomplete="off" ng-required="$mdAutocompleteCtrl.isRequired" ng-disabled="$mdAutocompleteCtrl.isDisabled" ng-model="$mdAutocompleteCtrl.scope.searchText" ng-keydown="$mdAutocompleteCtrl.keydown($event)" ng-blur="$mdAutocompleteCtrl.blur()" ng-focus="$mdAutocompleteCtrl.focus()" placeholder="" aria-owns="ul-0" aria-label="" aria-autocomplete="list" aria-haspopup="true" aria-activedescendant="" aria-expanded="false" class="ng-scope ng-valid ng-valid-required flex input-form form-control ng-dirty ng-valid-parse ng-touched" aria-disabled="false" aria-required="false" aria-invalid="false"> 

回答

0

不開箱的,但如果你只是想添加一些類你也許可以添加一個自定義指令來操縱元素。沿此線(未測試)的東西:

module.directive('myAutocomplete', function() { 
    return { 
     link: function(scope, elem, attr) { 
      elem.find('input')[0].classList.add('form-control', 'input-form'); 
     } 
    }; 
}); 

和美國這樣說:

<md-autocomplete my-autocomplete ....