2017-08-16 126 views
1

我有嘗試使用ng-show的這個基本示例。如果從國家/地區下拉框中選擇「GB」,我實際上只想顯示頁面的一部分。我已經驗證,當我從下拉框中選擇GB時,CTRL接收到'GB'。但是,元素最初並未隱藏在頁面上,並且從選擇框中選擇內容沒有任何影響。我會很感激任何幫助。ng-show沒有任何影響

<ng-form name="directorsForm" cc-pitch-form="5" ng-controller="work.myCtrl as ctrl"> 
    <div class="row cc-form__group"> 
     <div class="columns large-3"> 
      <label>Country</label> 
     </div> 
     <div class="columns large-3 left"> 
      <select ng-options="country.code as country.name for country in ctrl.countryList" ng-model="ctrl.selectedCountry" /> 
     </div> 
    </div> 

    <div ng-show="ctrl.selectedCountry =='GB'"> 
     <div class="columns large-3"> 
      <label>Enter address</label> 
     </div> 
    </div> 
</ng-form> 
+1

顯示你的控制器 – Sajeetharan

+1

你的ng顯示看起來很好,這個錯誤可能是在你的控制器或ng選項中 – awiebe

+0

我的控制器沒有任何關於它的邏輯。 –

回答

0

替換該行

<select ng-options="country.code as country.name for country in ctrl.countryList" ng-model="ctrl.selectedCountry" /> 

像選擇這

<select ng-options="country.code as country.name for country in ctrl.countryList" ng-model="ctrl.selectedCountry" ></select> 

自動關閉不工作的角度,我希望它可以幫助!

相關問題