@ -1,11 +1,11 @@
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {
|
||||
FORM_DIRECTIVES,
|
||||
ControlGroup,
|
||||
NgControl,
|
||||
Validators,
|
||||
NgFormModel,
|
||||
FormBuilder,
|
||||
ControlGroup,
|
||||
NgIf,
|
||||
NgFor,
|
||||
Component,
|
||||
@ -57,7 +57,8 @@ class ShowError {
|
||||
constructor(@Host() formDir: NgFormModel) { this.formDir = formDir; }
|
||||
|
||||
get errorMessage(): string {
|
||||
var control = (<ControlGroup>this.formDir.form).find(this.controlPath);
|
||||
var form: ControlGroup = this.formDir.form;
|
||||
var control = form.find(this.controlPath);
|
||||
if (isPresent(control) && control.touched) {
|
||||
for (var i = 0; i < this.errorTypes.length; ++i) {
|
||||
if (control.hasError(this.errorTypes[i])) {
|
||||
|
@ -66,7 +66,7 @@ class DataService {
|
||||
}
|
||||
|
||||
itemsFor(order: Order): OrderItem[] {
|
||||
return ListWrapper.filter(this.orderItems, i => i.orderId === order.orderId);
|
||||
return this.orderItems.filter(i => i.orderId === order.orderId);
|
||||
}
|
||||
|
||||
addItemForOrder(order: Order): void {
|
||||
|
@ -66,15 +66,14 @@ class DbService {
|
||||
}
|
||||
|
||||
drafts(): Promise<any[]> {
|
||||
return PromiseWrapper.then(this.getData(), (data) => {
|
||||
return ListWrapper.filter(data,
|
||||
(record => isPresent(record['draft']) && record['draft'] == true));
|
||||
return PromiseWrapper.then(this.getData(), (data: any[]) => {
|
||||
return data.filter(record => isPresent(record['draft']) && record['draft'] == true);
|
||||
});
|
||||
}
|
||||
|
||||
emails(): Promise<any[]> {
|
||||
return PromiseWrapper.then(this.getData(), (data) => {
|
||||
return ListWrapper.filter(data, (record => !isPresent(record['draft'])));
|
||||
return PromiseWrapper.then(this.getData(), (data: any[]) => {
|
||||
return data.filter(record => !isPresent(record['draft']));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import {bootstrap} from 'angular2/bootstrap';
|
||||
import {
|
||||
ControlGroup,
|
||||
NgIf,
|
||||
NgFor,
|
||||
Component,
|
||||
@ -11,7 +12,6 @@ import {
|
||||
Provider,
|
||||
FORM_DIRECTIVES,
|
||||
NgControl,
|
||||
ControlGroup,
|
||||
Validators,
|
||||
NgForm
|
||||
} from 'angular2/core';
|
||||
@ -81,7 +81,8 @@ class ShowError {
|
||||
constructor(@Host() formDir: NgForm) { this.formDir = formDir; }
|
||||
|
||||
get errorMessage(): string {
|
||||
var control = (<ControlGroup>this.formDir.form).find(this.controlPath);
|
||||
var form: ControlGroup = this.formDir.form;
|
||||
var control = form.find(this.controlPath);
|
||||
if (isPresent(control) && control.touched) {
|
||||
for (var i = 0; i < this.errorTypes.length; ++i) {
|
||||
if (control.hasError(this.errorTypes[i])) {
|
||||
|
@ -31,7 +31,7 @@ export class Store {
|
||||
remove(record: KeyModel): void { this._spliceOut(record); }
|
||||
|
||||
removeBy(callback: Predicate<KeyModel>): void {
|
||||
var records = ListWrapper.filter(this.list, callback);
|
||||
var records = this.list.filter(callback);
|
||||
ListWrapper.removeAll(this.list, records);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ export class Store {
|
||||
remove(record: KeyModel): void { this._spliceOut(record); }
|
||||
|
||||
removeBy(callback: Predicate<KeyModel>): void {
|
||||
var records = ListWrapper.filter(this.list, callback);
|
||||
var records = this.list.filter(callback);
|
||||
ListWrapper.removeAll(this.list, records);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user