From 2cfcd29257e95e614bb5562f59ebf8d13814d494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bengt=20Wei=C3=9Fe?= Date: Mon, 7 Jan 2019 08:19:32 +0100 Subject: [PATCH] fix(AlertComponent): check if d.buttons and d.inputs is defined Make sure buttons and inputs are defined. At least as empty array. Only add them to the template, if they are defined and habe at least one entry. --- src/components/alert/alert-component.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/alert/alert-component.ts b/src/components/alert/alert-component.ts index 6e3b6dcd8..23c402c9f 100644 --- a/src/components/alert/alert-component.ts +++ b/src/components/alert/alert-component.ts @@ -25,7 +25,7 @@ import { AlertButton, AlertInputOptions, AlertOptions } from './alert-options'; '

' + '' + '
' + - '
' + + '
' + '' + '
' + @@ -58,7 +58,7 @@ import { AlertButton, AlertInputOptions, AlertOptions } from './alert-options'; '' + '
' + - '
' + + '
' + '' + @@ -134,14 +134,14 @@ export class AlertCmp { // normalize the data const data = this.d; - data.buttons = data.buttons.map(button => { + data.buttons = data.buttons ? data.buttons.map(button => { if (typeof button === 'string') { return { text: button }; } return button; - }); + }) : []; - data.inputs = data.inputs.map((input, index) => { + data.inputs = data.inputs ? data.inputs.map((input, index) => { let r: AlertInputOptions = { type: input.type || 'text', name: isPresent(input.name) ? input.name : index + '', @@ -156,7 +156,7 @@ export class AlertCmp { max: isPresent(input.max) ? input.max : null }; return r; - }); + }) : []; // An alert can be created with several different inputs. Radios,