// Create a new Angular project // Replace src/index.html with the following: // // Replace src/main.ts with the following: import './polyfills'; import { enableProdMode } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { VERSION } from '@angular/core'; import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { FormsModule } from '@angular/forms'; // Starting template import { Component, Input } from '@angular/core'; export class Address { street: String; city: String; zipCode: String; } @Component({ selector: 'app-address', template: `

{{ address.street }}

{{ address.city }}

{{ address.zipCode }}

` }) export class AddressComponent { @Input() address: Address; constructor() { } } @Component({ selector: 'app-address-list', //Update this template template: `` }) export class AddressListComponent { @Input() addresses: Address[] = [{ street: "Street 1", city: "New York", zipCode: "1000" }, { street: "Street 2", city: "Washington", zipCode: "2000" }]; constructor() { } } // Main component @Component({ selector: 'app-main', template: `` }) export class AppComponent { name = 'Angular ' + VERSION.major; } // Module declaration @NgModule({ imports: [ BrowserModule, FormsModule ], declarations: [ AppComponent, AddressListComponent, AddressComponent ], bootstrap: [ AppComponent ] }) export class AppModule { } // Bootstrapping Angular platformBrowserDynamic().bootstrapModule(AppModule).then(ref => { // Ensure Angular destroys itself on hot reloads. if (window['ngRef']) { window['ngRef'].destroy(); } window['ngRef'] = ref; // Otherwise, log the boot error }).catch(err => console.error(err));