Skip to content

Commit

Permalink
Add id attribute and value set from Input Options
Browse files Browse the repository at this point in the history
  • Loading branch information
William Wallace committed Dec 2, 2016
1 parent 3532a71 commit 38de268
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
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">' +

This comment has been minimized.

Copy link
@manucorporat

manucorporat Dec 4, 2016

can you use id="{{i.id}}", I think it is better to use string interpolation in this case.

'</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}`,

This comment has been minimized.

Copy link
@manucorporat

manucorporat Dec 4, 2016

it should just use input.id ONLY if it exists

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

0 comments on commit 38de268

Please sign in to comment.