2017-01-30 1 views
0

Show, zeigt das Ergebnis nach Sprache an. Angenommen, Englisch ist dort in myAngApp1.value wird Englisch angezeigt. Aber in SharePoint Liste alle vier Sprachen Englisch Wert, so dass es Ergebnis 4 mal angezeigt wird. Meine Anforderung ist, wenn myAngApp1.value gleich Englisch ist, sollte es nicht 4 mal Englisch anzeigen.Zeige nur einen Wert in ng-show, wenn die gleichen Daten für die Bedingung kommen

   <span ng-show = "(customer.GLAcctLongTextEN).indexOf(myAngApp1.value)!=-1"> 
       {{customer.GLAcctLongTextEN}} 
      </span> 
       <span ng-show = "(customer.GLAcctLongTextPT).indexOf(myAngApp1.value)!=-1">  
       {{customer.GLAcctLongTextPT}} 
      </span> 

       <span ng-show = "(customer.GLAcctLongTextES).indexOf(myAngApp1.value)!=-1">  
       {{customer.GLAcctLongTextES}} 
      </span> 
       <span ng-show = "(customer.GLAcctLongTextZH).indexOf(myAngApp1.value)!=-1">  
       {{customer.GLAcctLongTextZH}} 
      </span> 
       <span ng-show = "(customer.GCoAGLcode).indexOf(myAngApp1.value)!=-1"> 
       {{customer.GLAcctLongTextEN}} 
      </span> 
      <span ng-show = "(customer.Title).indexOf(myAngApp1.value)!=-1" >  
       {{customer.GLAcctLongTextEN}} 
      </span> 
     </td> 
+2

Versuchen zu verwenden [Winkel-translate] (http://stackoverflow.com/questions/20540877/correct-use-for-angular-translate-in-controllers). – Mistalis

+0

@Mistalis hat Recht, es ist sinnlos, das Rad neu zu erfinden. – SinDeus

Antwort

0

Verwenden ng-Schalter. Unten ist der Beispielcode.

<p ng-switch="status"> 
    <span ng-switch-when="wrong"> 
     Wrong 
    </span> 
    <span ng-switch-default> 
     Correct 
    </span> 
</p> 
Verwandte Themen