diff options
Diffstat (limited to 'client/src/app/shared/shared-custom-markup/dynamic-element.service.ts')
-rw-r--r-- | client/src/app/shared/shared-custom-markup/dynamic-element.service.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/client/src/app/shared/shared-custom-markup/dynamic-element.service.ts b/client/src/app/shared/shared-custom-markup/dynamic-element.service.ts index 208dba721..a12907055 100644 --- a/client/src/app/shared/shared-custom-markup/dynamic-element.service.ts +++ b/client/src/app/shared/shared-custom-markup/dynamic-element.service.ts | |||
@@ -10,6 +10,7 @@ import { | |||
10 | SimpleChanges, | 10 | SimpleChanges, |
11 | Type | 11 | Type |
12 | } from '@angular/core' | 12 | } from '@angular/core' |
13 | import { objectKeysTyped } from '@shared/core-utils' | ||
13 | 14 | ||
14 | @Injectable() | 15 | @Injectable() |
15 | export class DynamicElementService { | 16 | export class DynamicElementService { |
@@ -41,12 +42,12 @@ export class DynamicElementService { | |||
41 | setModel <T> (componentRef: ComponentRef<T>, attributes: Partial<T>) { | 42 | setModel <T> (componentRef: ComponentRef<T>, attributes: Partial<T>) { |
42 | const changes: SimpleChanges = {} | 43 | const changes: SimpleChanges = {} |
43 | 44 | ||
44 | for (const key of Object.keys(attributes)) { | 45 | for (const key of objectKeysTyped(attributes)) { |
45 | const previousValue = componentRef.instance[key] | 46 | const previousValue = componentRef.instance[key] |
46 | const newValue = attributes[key] | 47 | const newValue = attributes[key] |
47 | 48 | ||
48 | componentRef.instance[key] = newValue | 49 | componentRef.instance[key] = newValue |
49 | changes[key] = new SimpleChange(previousValue, newValue, previousValue === undefined) | 50 | changes[key as string] = new SimpleChange(previousValue, newValue, previousValue === undefined) |
50 | } | 51 | } |
51 | 52 | ||
52 | const component = componentRef.instance | 53 | const component = componentRef.instance |