Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

fix(AlertComponent): check if d.buttons and d.inputs is defined #936

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KillerCodeMonkey
Copy link

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.

Short description of what this resolves:

the definition of d.buttons and d.inputs is not safe inside of the alert component.

Changes proposed in this pull request:

  • make sure d.buttons and d.inputs get correct defined in ionViewDidLoad
  • check if they are defined and contain at least one item to be added to the template

Fixes:
This is one issue if you run angular template checks.
e.g. if you run ngc with

"angularCompilerOptions": {
  "fullTemplateTypeCheck": true
}

in your tsconfig.json

Errors:

node_modules/ionic-angular/components/alert/alert-component.d.ts.AlertCmp.html(1,417): : Object is possibly 'undefined'.
node_modules/ionic-angular/components/alert/alert-component.d.ts.AlertCmp.html(1,1760): : Object is possibly 'undefined'.

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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant