Skip to content

Commit

Permalink
update(input): remove align input binding
Browse files Browse the repository at this point in the history
* The `align` input property for the `md-input-container` is not doing anything special and can be easily replaced with normal CSS from the user.

BREAKING CHANGE: The `align` input from the `<md-input-container>` component has been removed. Developers instead should use plain CSS to archive the same (using `text-align: end` for example)

Fixes angular#5140
  • Loading branch information
devversion committed Jun 15, 2017
1 parent 7b5b18d commit b2dccaf
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/demo-app/input/input-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ <h4>Inside a form</h4>
<md-toolbar color="primary">Prefix + Suffix</md-toolbar>
<md-card-content>
<h4>Text</h4>
<md-input-container align="end">
<md-input-container class="demo-text-align-end">
<input mdInput placeholder="amount">
<span mdPrefix>$&nbsp;</span>
<span mdSuffix>.00</span>
Expand Down Expand Up @@ -301,13 +301,13 @@ <h4>Textarea</h4>
<input mdInput placeholder="Prefixed" value="example">
<div mdPrefix>Example:&nbsp;</div>
</md-input-container>
<md-input-container align="end">
<md-input-container class="demo-text-align-end">
<input mdInput placeholder="Suffixed" value="123">
<span mdSuffix>.00 €</span>
</md-input-container>
<br/>
Both:
<md-input-container align="end">
<md-input-container class="demo-text-align-end">
<input mdInput #email placeholder="Email Address" value="angular-core">
<span mdPrefix><md-icon [class.primary]="email.focused">email</md-icon>&nbsp;</span>
<span mdSuffix [class.primary]="email.focused">&nbsp;@gmail.com</span>
Expand Down
4 changes: 4 additions & 0 deletions src/demo-app/input/input-demo.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
margin: 16px;
}

.demo-text-align-end {
text-align: end;
}

.demo-textarea {
resize: none;
border: none;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/input/input-container.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<ng-content select="[mdPrefix], [matPrefix]"></ng-content>
</div>

<div class="mat-input-infix" [class.mat-end]="align == 'end'">
<div class="mat-input-infix">
<ng-content selector="input, textarea"></ng-content>

<span class="mat-input-placeholder-wrapper">
Expand Down
8 changes: 0 additions & 8 deletions src/lib/input/input-container.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,6 @@ $mat-input-underline-height: 1px !default;
// Needed to make last line of the textarea line up with the baseline.
vertical-align: bottom;

.mat-end & {
text-align: right;

[dir='rtl'] & {
text-align: left;
}
}

// Undo the red box-shadow glow added by Firefox on invalid inputs.
// See https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-ui-invalid
&:-moz-ui-invalid {
Expand Down
3 changes: 0 additions & 3 deletions src/lib/input/input-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,6 @@ export class MdInputDirective {
export class MdInputContainer implements AfterViewInit, AfterContentInit, AfterContentChecked {
private _placeholderOptions: PlaceholderOptions;

/** Alignment of the input container's content. */
@Input() align: 'start' | 'end' = 'start';

/** Color of the input divider, based on the theme. */
@Input() color: 'primary' | 'accent' | 'warn' = 'primary';

Expand Down

0 comments on commit b2dccaf

Please sign in to comment.