5 changed files with 7 additions and 43 deletions
@ -1,33 +0,0 @@ |
|||
import {ChangeDetectionStrategy, Component, Input} from '@angular/core'; |
|||
import {orderStatusOptions} from '../../proxy/orders'; |
|||
|
|||
@Component({ |
|||
selector: 'lib-order-status', |
|||
template: ` |
|||
{{statusText}} |
|||
`,
|
|||
changeDetection: ChangeDetectionStrategy.OnPush |
|||
}) |
|||
export class OrderStatusComponent { |
|||
|
|||
@Input() |
|||
set id(v: number) { |
|||
this.statusText = this.idToText(v); |
|||
} |
|||
|
|||
options = orderStatusOptions; |
|||
|
|||
statusText: string; |
|||
|
|||
private idToText(id: number): string | null { |
|||
console.log('hello', new Date().toLocalISOString()) |
|||
const item = this.options.find(x => x.value === id); |
|||
|
|||
if (!item) { |
|||
return null; |
|||
} |
|||
return item.key; |
|||
} |
|||
|
|||
|
|||
} |
|||
@ -1,18 +1,13 @@ |
|||
import { NgModule } from '@angular/core'; |
|||
import { OrderingRoutingModule } from './ordering-routing.module'; |
|||
import { OrderStatusComponent } from './lib/components/order-status/order-status.component'; |
|||
|
|||
|
|||
@NgModule({ |
|||
declarations: [ |
|||
OrderStatusComponent |
|||
], |
|||
imports: [ |
|||
OrderingRoutingModule |
|||
], |
|||
exports: [ |
|||
OrderStatusComponent |
|||
] |
|||
exports: [] |
|||
}) |
|||
export class OrderingModule { |
|||
} |
|||
|
|||
Loading…
Reference in new issue