title: Buttons in angular 2
body: <p>I have 2 buttons in my template, the first: </p>
  
  <pre><code>&lt;button 
   [style.background-color]="service_rec.status == 
   'Online' ? 'green' : 'red'" class="btn btn-default"&gt;
                {{ service_rec.status }}
   &lt;/button&gt;
  </code></pre>
  
  <p>And second: </p>
  
  <pre><code>&lt;button *ngIf="!!service_rec.servicecontrolled" 
    [style.background-color]="service_rec.controlled == 
    'true' ? 'green' : 'orange'"
    class="btn btn-warning"
    (click)="onPost(service_rec.title, service_rec.status, service_rec.id)"&gt;
    {{ service_rec.servicecontrolled | json | toOnOff }}
  &lt;/button&gt;
  </code></pre>
  
  <p>Last button have pipe: </p>
  
  <pre><code> @Pipe({ name: 'toOnOff' })
    export class OnOffPipe implements PipeTransform {
    transform(value: boolean): string {
      return (!!value) ? 'Stop' : 'false';
    }
  }
  </code></pre>
  
  <p>And how to create a pipe, which able to create a <code>'Start'</code> (not <code>'Stop'</code>) button, when second button is <code>'Offline'</code> (not <code>'Online'</code>) </p>
  
  <p><a href="https://i.stack.imgur.com/YcJvH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YcJvH.png" alt="enter image description here"></a></p>