2017-07-08 51 views
0

我這裏有一個片斷如何在AngularJS中自定義顯示的文本材料選擇選項組?

<span class="filter-lbl">Filter&nbsp;by:</span> 
<md-input-container> 
    <md-select md-container-class="filter-contribution-cont" ng-model="selected" ng-change="selectedChanged(); updateSelectedContribution();" multiple> 
     <md-optgroup> 
      <md-option ng-value="data.label" ng-click="dropdownClick(data)" ng-selected="data.selected" ng-repeat="data in dataSet | unique: 'label'">{{data.label}}</md-option> 
     </md-optgroup> 
    </md-select> 
</md-input-container> 

,比如我有,我提出來構建我要顯示命名爲getSelectedContributions(),文字的功能如何更換內置顯示的文本由AngularJS材料製成?

我對AngularJS仍然很陌生,所以如果可能的話我需要一個簡單的解決方案。謝謝!

+0

你可以創建一個蹲點 – Sajeetharan

回答

0

找到了答案。我只需要在md-select這樣加md-selected-text="getSelectedContributions()"這樣

<span class="filter-lbl">Filter&nbsp;by:</span> 
<md-input-container> 
    <md-select md-selected-text="getSelectedContributions()" md-container-class="filter-contribution-cont" ng-model="selected" ng-change="selectedChanged(); updateSelectedContribution();" multiple> 
     <md-optgroup> 
      <md-option ng-value="data.label" ng-click="dropdownClick(data)" ng-selected="data.selected" ng-repeat="data in dataSet | unique: 'label'">{{data.label}}</md-option> 
     </md-optgroup> 
    </md-select> 
</md-input-container> 
相關問題