adding an array


@Component({
    template: `
 <h1>{{ title }} ({{title.length}})</h1>
 <input [(ngModel)]="title">
 <h2 *ngIf="title.length>15"> the title is long!!!</h2>
 <button (click)="click()">my button</button>
 <br/>
-Order: {{order.orderId}}<br/>
Order: {{orders[0].orderId}}<br/>
-Customer: {{order.customerId}}
Customer: {{orders[0].customerId}}
`
})

@Injectable()
export class AppComponent {

    title = 'Orders';
-   order = {
    orders = [{
        orderId: 5,
        customerId: "abc"
    },
    {
        orderId: 6,
        customerId: "xyz"
    }];
-   };

    click() {
        this.title += "button was clicked";
    }
} 

Commit info on GitHub


Help us improve, Edit this page on GitHub
or email us at info@fireflymigration.com