Dynamic Play/pause

Hi, i’m trying to create a dynamic play/pause button.

if my item.status = play the icon gonna be pause and vice versa

is it doable ?


yes it is . I made a similar function.
Just use 2 different buttons with 2 different ng-if condition depending on the item.state
You will only see the relative one
i.e button pause if item.state=play; button play if item.state!=play
If you have problem I will post a sample when I go home

you could do it like…


<div ng-if="itemValue('SonosBueroCont')=='PLAY'">
  <button class="btn btn-sm" style="background: green; color: white"
  ng-click="sendCmd('SonosBueroCont', 'PAUSE')">
  <i class="glyphicon glyphicon-play" style="width: 3em"></i>

<div ng-if="itemValue('SonosBueroCont')=='PAUSE'">
  <button class="btn btn-sm" style="background: gray; color: black"
  ng-click="sendCmd('SonosBueroCont', 'PLAY')">
  <i class="glyphicon glyphicon-stop" style="width: 3em"></i>

thanks !