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

docs(input): remove extra parens and fix nits #6614

Merged
merged 1 commit into from
Aug 24, 2017
Merged
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
16 changes: 8 additions & 8 deletions src/lib/input/input.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ elements inside `md-form-field` as well. This includes Angular directives such a

The only limitations are that the `type` attribute can only be one of the values supported by
`mdInput` and the native element cannot specify a `placeholder` attribute if the `md-form-field`
also contains a `md-placeholder` element.
also contains an `md-placeholder` element.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a was correct, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arguably haha. I'm basing it on the pronunciation of "md" sounding like "em dee". See APA blog referencing the subject.


### Supported `input` types

Expand Down Expand Up @@ -56,7 +56,7 @@ text. When text is present, the indicative text will float above this input zone
The `floatPlaceholder` attribute of `md-form-field` can be set to `never` to hide the
indicative text instead when text is present in the input.

When setting `floatPlaceholder` to `always` the floating label will always show above the input.
When setting `floatPlaceholder` to `always`, the floating label will always show above the input.

A placeholder for the input can be specified in one of two ways: either using the `placeholder`
attribute on the `input` or `textarea`, or using an `md-placeholder` element in the
Expand All @@ -68,7 +68,7 @@ provider. This setting will apply to all components that support the floating pl
```ts
@NgModule({
providers: [
{provide: MD_PLACEHOLDER_GLOBAL_OPTIONS, useValue: { float: 'always' }}
{provide: MD_PLACEHOLDER_GLOBAL_OPTIONS, useValue: {float: 'always'}}
]
})
```
Expand All @@ -81,8 +81,8 @@ Here are the available global options:

### Prefix and Suffix

HTML can be included before, and after the input tag, as prefix or suffix. It will be underlined as
per the Material specification, and clicking it will focus the input.
HTML can be included before and after the input tag, as a prefix or suffix. It will be underlined
as per the Material specification, and clicking it will focus the input.

Adding the `mdPrefix` attribute to an element inside the `md-form-field` will designate it as
the prefix. Similarly, adding `mdSuffix` will designate it as the suffix.
Expand Down Expand Up @@ -129,18 +129,18 @@ the error messages.
function myErrorStateMatcher(control: FormControl, form: FormGroupDirective | NgForm): boolean {
// Error when invalid control is dirty, touched, or submitted
const isSubmitted = form && form.submitted;
return !!(control.invalid && (control.dirty || control.touched || isSubmitted)));
return !!(control.invalid && (control.dirty || control.touched || isSubmitted));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The coercion here seems to be unnecessary since all fields are boolean.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it is unnecessary, but it's based on the default errorStateMatcher which originates from #3560 (comment).

Happy to change it if coercion is unnecessary, but it does add a little type safety. A little more discussion in #6585

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has an effect because isSubmitted is potentially undefined (if form is undefined)

}
```

A global error state matcher can be specified by setting the `MD_ERROR_GLOBAL_OPTIONS` provider. This applies
to all inputs. For convenience, `showOnDirtyErrorStateMatcher` is available in order to globally cause
to all inputs. For convenience, `showOnDirtyErrorStateMatcher` is available in order to globally set
input errors to show when the input is dirty and invalid.

```ts
@NgModule({
providers: [
{provide: MD_ERROR_GLOBAL_OPTIONS, useValue: { errorStateMatcher: showOnDirtyErrorStateMatcher }}
{provide: MD_ERROR_GLOBAL_OPTIONS, useValue: {errorStateMatcher: showOnDirtyErrorStateMatcher}}
]
})
```
Expand Down