<html lang="en"><head></head><body><form id="mainForm" method="post" action="http://plnkr.co/edit/?p=preview" target="_self"><input type="hidden" name="files[app/app-routing.module.ts]" value="import { NgModule } from '@angular/core';
import { Routes, RouterModule }  from '@angular/router';

import { MovieListComponent } from './movie-list.component';

const routes: Routes = [
  { path: '', redirectTo: '/movies', pathMatch: 'full' },
  { path: 'movies', component: MovieListComponent }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule {}


/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/"><input type="hidden" name="files[app/app.component.ts]" value="import { Component } from '@angular/core';

import { MovieService } from './movie.service';
import { IMovie } from './movie';

@Component({
  moduleId: module.id,
  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: [ './app.component.css' ],
  providers: [ MovieService ]
})
export class AppComponent {

  angularDocsUrl = 'https://angular.io/';
  colorPreference = 'red';
  eventType = '<not clicked yet>';
  isActive = true;
  isImportant = true;
  movie: IMovie = null;
  movies: IMovie[] = [];
  showImage = true;
  title: string = 'AngularJS to Angular Quick Ref Cookbook';
  toggleImage(event: UIEvent) {
    this.showImage = !this.showImage;
    this.eventType = (event &amp;&amp; event.type) || 'not provided';
  }

  constructor(movieService: MovieService) {
    this.movies = movieService.getMovies();
    this.movie = this.movies[0];
  }
}


/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/"><input type="hidden" name="files[app/app.module.ts]" value="import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule }   from '@angular/forms';

import { AppComponent }  from './app.component';
import { MovieListComponent } from './movie-list.component';
import { AppRoutingModule } from './app-routing.module';

@NgModule({
  imports: [
    BrowserModule,
    FormsModule,
    AppRoutingModule
  ],
  declarations: [
    AppComponent,
    MovieListComponent
  ],
  bootstrap: [ AppComponent ]
})
export class AppModule { }


/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/"><input type="hidden" name="files[app/date.pipe.ts]" value="import { Injectable, Pipe, PipeTransform } from '@angular/core';
import { DatePipe } from '@angular/common';

@Injectable()
@Pipe({name: 'date', pure: true})
export class StringSafeDatePipe extends DatePipe implements PipeTransform {
 transform(value: any, format: string): string {
   value = typeof value === 'string' ?
           Date.parse(value) : value;
   return super.transform(value, format);
 }
}


/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/"><input type="hidden" name="files[app/movie-list.component.ts]" value="/* tslint:disable:no-unused-variable */
import { Component } from '@angular/core';
import { IMovie } from './movie';
import { MovieService } from './movie.service';

@Component({
  moduleId: module.id,
  selector: 'movie-list',
  templateUrl: './movie-list.component.html',
  styleUrls: [ './movie-list.component.css' ],
})
export class MovieListComponent {
  favoriteHero: string;
  showImage: boolean = false;
  movies: IMovie[];

  constructor(movieService: MovieService) {
    this.movies = movieService.getMovies();
  }

  toggleImage(): void {
    this.showImage = !this.showImage;
  }

  checkMovieHero(value: string): boolean {
    return this.movies.filter(movie => movie.hero === value).length > 0 ;
  }
}


/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/"><input type="hidden" name="files[app/movie.service.ts]" value="import { Injectable } from '@angular/core';

import { IMovie } from './movie';

@Injectable()
export class MovieService {
  getMovies(): IMovie[] {
    return [
      {
        hero: 'Celeritas',
        imageurl: 'images/hero.png',
        movieId: 1,
        mpaa: 'pg-13',
        releaseDate: '2015-12-19T00:00:00',
        title: 'Celeritas Reigns',
        price: 12.95,
        starRating: 4.925,
        approvalRating: .97
      },
      {
        hero: 'Mr. Nice',
        imageurl: 'images/villain.png',
        movieId: 2,
        mpaa: 'pg-13',
        releaseDate: '2015-12-18T00:00:00',
        title: 'No More Mr. Nice Guy',
        price: 14.95,
        starRating: 4.6,
        approvalRating: .94
      },
      {
        hero: 'Angular',
        imageurl: 'images/ng-logo.png',
        movieId: 3,
        mpaa: 'pg-13',
        releaseDate: '2015-12-17T00:00:00',
        title: 'Angular to the Rescue',
        price: 15.95,
        starRating: 4.98,
        approvalRating: .9995
      }
    ];
  }
}


/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/"><input type="hidden" name="files[app/movie.ts]" value="/* Defines the movie entity */
export interface IMovie {
  approvalRating: number;
  hero: string;
  imageurl: string;
  movieId: number;
  mpaa: string;
  price: number;
  releaseDate: string;
  starRating: number;
  title: string;
}


/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/"><input type="hidden" name="files[main.ts]" value="import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';

platformBrowserDynamic().bootstrapModule(AppModule);


/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/"><input type="hidden" name="files[app/app.component.css]" value=".active {font-style: italic;}
.shazam {font-weight: bold;}

img {height: 100px;}

table td {
  padding: 4px;
  border: 1px solid #e0e0e0;
}


/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/"><input type="hidden" name="files[app/movie-list.component.css]" value="div {
  font-family:Arial, Helvetica, sans-serif;
  margin:20px;
}

table {
  font-family:Arial, Helvetica, sans-serif;
  color:#666;
  font-size:14px;
  text-shadow: 1px 1px 0 #fff;
  margin:20px;
  border:#ccc 1px solid;

  -moz-border-radius:3px;
  -webkit-border-radius:3px;
  border-radius:3px;
}
table th {
  padding:21px 25px 22px 25px;
  border-top:1px solid #fafafa;
  border-bottom:1px solid #e0e0e0;
  border-left: 1px solid #e0e0e0;
  font-weight: bold;
}
table th:first-child {
  text-align: left;
  padding-left:20px;
  border-left: 0;
}
table tr {
  text-align: center;
  padding-left:20px;
}
table td:first-child {
  text-align: left;
  padding-left:20px;
  border-left: 0;
}
table td {
  padding:18px;
  border-top: 1px solid #ffffff;
  border-bottom:1px solid #e0e0e0;
  border-left: 1px solid #e0e0e0;
}
table tr:last-child td {
  border-bottom:0;
}
table tr:last-child td:first-child {
  -moz-border-radius-bottomleft:3px;
  -webkit-border-bottom-left-radius:3px;
  border-bottom-left-radius:3px;
}
table tr:last-child td:last-child {
  -moz-border-radius-bottomright:3px;
  -webkit-border-bottom-right-radius:3px;
  border-bottom-right-radius:3px;
}


/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/"><input type="hidden" name="files[styles.css]" value="/* Master Styles */
h1 {
  color: #369;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 250%;
}
h2, h3 {
  color: #444;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: lighter;
}
body {
  margin: 2em;
}
body, input[text], button {
  color: #888;
  font-family: Cambria, Georgia;
}
a {
  cursor: pointer;
  cursor: hand;
}
button {
  font-family: Arial;
  background-color: #eee;
  border: none;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  cursor: hand;
}
button:hover {
  background-color: #cfd8dc;
}
button:disabled {
  background-color: #eee;
  color: #aaa;
  cursor: auto;
}

/* Navigation link styles */
nav a {
  padding: 5px 10px;
  text-decoration: none;
  margin-right: 10px;
  margin-top: 10px;
  display: inline-block;
  background-color: #eee;
  border-radius: 4px;
}
nav a:visited, a:link {
  color: #607D8B;
}
nav a:hover {
  color: #039be5;
  background-color: #CFD8DC;
}
nav a.active {
  color: #039be5;
}

/* items class */
.items {
  margin: 0 0 2em 0;
  list-style-type: none;
  padding: 0;
  width: 24em;
}
.items li {
  cursor: pointer;
  position: relative;
  left: 0;
  background-color: #EEE;
  margin: .5em;
  padding: .3em 0;
  height: 1.6em;
  border-radius: 4px;
}
.items li:hover {
  color: #607D8B;
  background-color: #DDD;
  left: .1em;
}
.items li.selected {
  background-color: #CFD8DC;
  color: white;
}
.items li.selected:hover {
  background-color: #BBD8DC;
}
.items .text {
  position: relative;
  top: -3px;
}
.items .badge {
  display: inline-block;
  font-size: small;
  color: white;
  padding: 0.8em 0.7em 0 0.7em;
  background-color: #607D8B;
  line-height: 1em;
  position: relative;
  left: -1px;
  top: -4px;
  height: 1.8em;
  margin-right: .8em;
  border-radius: 4px 0 0 4px;
}
/* everywhere else */
* {
  font-family: Arial, Helvetica, sans-serif;
}


/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/"><input type="hidden" name="files[app/app.component.html]" value="<h1>{{title}}</h1>

<h3>Routed Movies</h3>
<nav>
  <a [routerLink]=&quot;['/movies']&quot;>Movies</a>
</nav>
<router-outlet></router-outlet>

<hr>

<h1>Example Snippets</h1>

<div [ngClass]=&quot;{active: isActive}&quot;>
  [ngClass] active
</div>
<div [ngClass]=&quot;{active: isActive,
                 shazam: isImportant}&quot;>
  [ngClass] active and boldly important
</div>
<div [class.active]=&quot;isActive&quot;>
  [class.active]
</div>

<p></p>
<a [href]=&quot;angularDocsUrl&quot;>Angular Docs</a>

<p></p>
<div>
  <button (click)=&quot;toggleImage()&quot;>
  Image Toggle #1</button>
  <button (click)=&quot;toggleImage($event)&quot;>
  Image Toggle #2</button>
  <p>Image toggle event type was {{eventType}}</p>
</div>

<p></p>
<div *ngIf=&quot;showImage&quot;>
  <img [src]=&quot;movie.imageurl&quot;>
</div>

<p></p>
<div [ngStyle]=&quot;{color: colorPreference}&quot;>
  color preference #1
</div>
<div [style.color]=&quot;colorPreference&quot;>
  color preference #2
</div>

<h3>Movie as JSON</h3>
<pre>{{movie | json}}</pre>

<h3>Movie Titles via local variable</h3>
<table>
<tr *ngFor=&quot;let movie of movies&quot;>
  <td>{{movie.title}}</td>
</tr>
</table>

<h3>Sliced Movies with pipes</h3>
<table>
<tr *ngFor=&quot;let movie of movies | slice:0:2&quot;>

  <td>{{movie.title | uppercase}}</td>

  <td>{{movie.title | lowercase}}</td>

  <td>{{movie.releaseDate | date}}</td>

  <td>{{movie.price | currency:'USD':true}}</td>

  <td>{{movie.starRating | number}}</td>
  <td>{{movie.starRating | number:'1.1-2'}}</td>
  <td>{{movie.approvalRating | percent: '1.0-2'}}</td>

</tr></table>


<!-- 
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
-->"><input type="hidden" name="files[app/movie-list.component.html]" value="<!-- Filter the Movie Title   -->
<div>
  <h2>Movie List</h2>
  <div>Who is your favorite hero?</div>
  <div>
    <input [(ngModel)]=&quot;favoriteHero&quot; />

    <span [ngSwitch]=&quot;favoriteHero &amp;&amp;
                   checkMovieHero(favoriteHero)&quot;>
      <p *ngSwitchCase=&quot;true&quot;>
        Excellent choice!
      </p>
      <p *ngSwitchCase=&quot;false&quot;>
        No movie, sorry!
      </p>
      <p *ngSwitchDefault>
        Please enter your favorite hero.
      </p>
    </span>
  </div>
</div>

<h3 [hidden]=&quot;!favoriteHero&quot;>
  Your favorite hero is: {{favoriteHero}}
</h3>

<div>
  <table *ngIf=&quot;movies.length&quot;>
    <thead>
      <tr>
        <th>
          <button (click)=&quot;toggleImage()&quot;>
            {{showImage ? &quot;Hide&quot; : &quot;Show&quot;}} Poster
          </button>
        </th>
        <th>Title</th>
        <th>Hero</th>
        <th>Release Date</th>
        <th>Rating</th>
        <th>Price</th>
        <th>Star rating</th>
        <th>Approval rating</th>
      </tr>
    </thead>
    <tbody>
      <tr *ngFor=&quot;let movie of movies&quot;>
        <td>
          <img [hidden]=&quot;!showImage || !movie.imageurl&quot;
                [style.height.px]=&quot;50&quot;
                [style.margin.px]=&quot;2&quot;
                [src]=&quot;movie.imageurl&quot;
                [title]=&quot;movie.title&quot;>
        </td>
        <td>{{movie.title}}</td>
        <td>{{movie.hero}}</td>
        <td>{{movie.releaseDate | date}}</td>
        <td>{{movie.mpaa | uppercase}}</td>
        <td>{{movie.price | currency:'USD':true}}</td>
        <td>{{movie.starRating | number:'1.1-2'}}</td>
        <td>{{movie.approvalRating | percent: '1.0-0'}}</td>
      </tr>
    </tbody>
  </table>
</div>


<!-- 
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
-->"><input type="hidden" name="files[index.html]" value="<!DOCTYPE html>
<html>
  <head>
    <script>document.write('<base href=&quot;' + document.location + '&quot; />');</script>
    <meta charset=&quot;UTF-8&quot;>
    <title>AngularJS to Angular Quick Reference</title>
    <meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;>
    <link rel=&quot;stylesheet&quot; href=&quot;styles.css&quot;>

    <!-- Polyfills -->
    <script src=&quot;https://unpkg.com/core-js/client/shim.min.js&quot;></script>

    <script src=&quot;https://unpkg.com/zone.js@0.7.4?main=browser&quot;></script>
    <script src=&quot;https://unpkg.com/systemjs@0.19.39/dist/system.src.js&quot;></script>

    <script src=&quot;https://cdn.rawgit.com/angular/angular.io/b3c65a9/public/docs/_examples/_boilerplate/systemjs.config.web.js&quot;></script>
    <script>
      System.import('main.js').catch(function(err){ console.error(err); });
    </script>
  </head>

  <body>
    <my-app>Loading app...</my-app>
  </body>

</html>


<!-- 
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
-->"><input type="hidden" name="files[images/hero.base64.png]" value="[encoded data, 9752 characters]"><input type="hidden" name="files[images/ng-logo.base64.png]" value="[encoded data, 9640 characters]"><input type="hidden" name="files[images/villain.base64.png]" value="[encoded data, 14552 characters]"><input type="hidden" name="tags[0]" value="angular"><input type="hidden" name="tags[1]" value="example"><input type="hidden" name="tags[2]" value="cookbook"><input type="hidden" name="tags[3]" value="angularjs"><input type="hidden" name="private" value="true"><input type="hidden" name="description" value="Angular Example - AngularJS to Angular Quick Reference"></form><script>document.getElementById("mainForm").submit();</script></body></html>