Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add id attribute and value set from Input Options #9458

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/alert/alert-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import { ViewController } from '../../navigation/view-controller';
'<template ngSwitchDefault>' +
'<div class="alert-input-group">' +
'<div *ngFor="let i of d.inputs" class="alert-input-wrapper">' +
'<input [placeholder]="i.placeholder" [(ngModel)]="i.value" [type]="i.type" class="alert-input">' +
'<input [placeholder]="i.placeholder" [(ngModel)]="i.value" [type]="i.type" [id]="i.id" class="alert-input">' +
'</div>' +
'</div>' +
'</template>' +
Expand Down Expand Up @@ -153,7 +153,7 @@ export class AlertCmp {
label: input.label,
checked: !!input.checked,
disabled: !!input.disabled,
id: `alert-input-${this.id}-${index}`,
id: `alert-input-${input.id}-${index}`,
handler: isPresent(input.handler) ? input.handler : null,
};
});
Expand Down
6 changes: 4 additions & 2 deletions src/components/alert/alert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ export class Alert extends ViewController {
* inputs. Do note however, different types of "text"" inputs can be mixed,
* such as `url`, `email`, `text`, etc. If you require a complex form UI
* which doesn't fit within the guidelines of an alert then we recommend
* building the form within a modal instead.
* building the form within a modal instead. When using the `id` option, please
* note the value of `id` will be written to the DOM as `alert-input-[id]-[index]`,
* where index is the index of the input option.
*
*
* @usage
Expand Down Expand Up @@ -231,7 +233,7 @@ export class Alert extends ViewController {
* | value | `string` | The input's value. |
* | label | `string` | The input's label (only for radio/checkbox inputs) |
* | checked | `boolean` | Whether or not the input is checked. |
* | id | `string` | The input's id. |
* | id | `string` | The input's id.(written to the DOM as alert-input-{id}-{index}) |
*
* Button options
*
Expand Down