1

I have 3 document-types.

  • document
  • folder
  • documentplace

if the expression is {{documenttype}} = document, than create a document-icon. if the expression is {{documenttype}} = folder than create a folder icon. if the expression is {{documenttype}} = documentplace than create a adress icon.

I know excactly to do this in php, but in angular im a little bit over asked.

Mistalis
  • 17,793
  • 13
  • 73
  • 97
Fonty
  • 159
  • 1
  • 15

1 Answers1

0

You can use ng-switch to do the trick. It will evaluates the expression in on, and display a div according to the value:

<div ng-switch on="documenttype">

    <div ng-switch-when="document">
        <img src="document.png"/>
    </div>

    <div ng-switch-when="folder">
        <img src="folder.png"/>
    </div>

    <div ng-switch-when="documentplace">
        <img src="documentplace.png"/>
    </div>

</div>
Mistalis
  • 17,793
  • 13
  • 73
  • 97