angular 2 ngIf and CSS transition/animation
<p>I want a div to slide in from the right in angular 2 using css.</p>

<pre><code>  &lt;div class="note" [ngClass]="{'transition':show}" *ngIf="show"&gt;
    &lt;p&gt; Notes&lt;/p&gt;
  &lt;/div&gt;
  &lt;button class="btn btn-default" (click)="toggle(show)"&gt;Toggle&lt;/button&gt;
</code></pre>

<p>I works fine if i only use [ngClass] to toggle class and utilise opacity.
But li don't want that element to be rendered from the beginning so I "hide" it with ngIf first, but then the transition wont't work.</p>

<pre><code>.transition{
  -webkit-transition: opacity 1000ms ease-in-out,margin-left 500ms ease-in-out;
  -moz-transition: opacity 1000ms ease-in-out,margin-left 500ms ease-in-out;
  -ms-transition: opacity 1000ms ease-in-out,margin-left 500ms ease-in-out ;
  -o-transition: opacity 1000ms ease-in-out,margin-left 500ms ease-in-out;
  transition: opacity 1000ms ease-in-out,margin-left 500ms ease-in-out;
  margin-left: 1500px;
  width: 200px;
  opacity: 0;
}

.transition{
  opacity: 100;
  margin-left: 0;
}
</code></pre>