chore(playground): clang-format
This commit is contained in:

committed by
Alex Rickabaugh

parent
0d1f3c3b07
commit
6baf3baedd
@ -6,17 +6,10 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {bootstrap} from '@angular/platform-browser-dynamic';
|
||||
import {
|
||||
Component,
|
||||
EventEmitter,
|
||||
Injectable,
|
||||
Input,
|
||||
Output
|
||||
} from '@angular/core';
|
||||
import {NgIf, NgFor, FORM_DIRECTIVES} from '@angular/common';
|
||||
|
||||
import {FORM_DIRECTIVES, NgFor, NgIf} from '@angular/common';
|
||||
import {Component, EventEmitter, Injectable, Input, Output} from '@angular/core';
|
||||
import {ListWrapper} from '@angular/core/src/facade/collection';
|
||||
import {bootstrap} from '@angular/platform-browser-dynamic';
|
||||
|
||||
/**
|
||||
* You can find the Angular 1 implementation of this example here:
|
||||
@ -26,15 +19,17 @@ import {ListWrapper} from '@angular/core/src/facade/collection';
|
||||
// ---- model
|
||||
|
||||
class OrderItem {
|
||||
constructor(public orderItemId: number, public orderId: number, public productName: string,
|
||||
public qty: number, public unitPrice: number) {}
|
||||
constructor(
|
||||
public orderItemId: number, public orderId: number, public productName: string,
|
||||
public qty: number, public unitPrice: number) {}
|
||||
|
||||
get total(): number { return this.qty * this.unitPrice; }
|
||||
}
|
||||
|
||||
class Order {
|
||||
constructor(public orderId: number, public customerName: string, public limit: number,
|
||||
private _dataService: DataService) {}
|
||||
constructor(
|
||||
public orderId: number, public customerName: string, public limit: number,
|
||||
private _dataService: DataService) {}
|
||||
|
||||
get items(): OrderItem[] { return this._dataService.itemsFor(this); }
|
||||
get total(): number { return this.items.map(i => i.total).reduce((a, b) => a + b, 0); }
|
||||
@ -53,17 +48,16 @@ class DataService {
|
||||
|
||||
constructor() {
|
||||
this.orders = [
|
||||
new Order(_nextId++, "J. Coltrane", 100, this),
|
||||
new Order(_nextId++, "B. Evans", 200, this)
|
||||
new Order(_nextId++, 'J. Coltrane', 100, this), new Order(_nextId++, 'B. Evans', 200, this)
|
||||
];
|
||||
|
||||
this.orderItems = [
|
||||
new OrderItem(_nextId++, this.orders[0].orderId, "Bread", 5, 1),
|
||||
new OrderItem(_nextId++, this.orders[0].orderId, "Brie", 5, 2),
|
||||
new OrderItem(_nextId++, this.orders[0].orderId, "IPA", 5, 3),
|
||||
new OrderItem(_nextId++, this.orders[0].orderId, 'Bread', 5, 1),
|
||||
new OrderItem(_nextId++, this.orders[0].orderId, 'Brie', 5, 2),
|
||||
new OrderItem(_nextId++, this.orders[0].orderId, 'IPA', 5, 3),
|
||||
|
||||
new OrderItem(_nextId++, this.orders[1].orderId, "Mozzarella", 5, 2),
|
||||
new OrderItem(_nextId++, this.orders[1].orderId, "Wine", 5, 3)
|
||||
new OrderItem(_nextId++, this.orders[1].orderId, 'Mozzarella', 5, 2),
|
||||
new OrderItem(_nextId++, this.orders[1].orderId, 'Wine', 5, 3)
|
||||
];
|
||||
}
|
||||
|
||||
@ -72,7 +66,7 @@ class DataService {
|
||||
}
|
||||
|
||||
addItemForOrder(order: Order): void {
|
||||
this.orderItems.push(new OrderItem(_nextId++, order.orderId, "", 0, 0));
|
||||
this.orderItems.push(new OrderItem(_nextId++, order.orderId, '', 0, 0));
|
||||
}
|
||||
|
||||
deleteItem(item: OrderItem): void { ListWrapper.remove(this.orderItems, item); }
|
||||
|
Reference in New Issue
Block a user