Skip to content

fix(form-field): annotate base class with Directive for Ivy #17457

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

Merged
merged 1 commit into from
Oct 21, 2019
Merged
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
7 changes: 7 additions & 0 deletions src/material/form-field/form-field-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@

import {Observable} from 'rxjs';
import {NgControl} from '@angular/forms';
import {Directive} from '@angular/core';


/** An interface which allows a control to work inside of a `MatFormField`. */
@Directive({
// The @Directive with selector is required here because we're still running a lot of things
// against ViewEngine where directives without selectors are not allowed.
// TODO(crisbeto): convert to a selectorless Directive after we switch to Ivy.
selector: 'do-not-use-abstract-mat-form-field-control',
})
export abstract class MatFormFieldControl<T> {
/** The value of the control. */
value: T | null;
Expand Down
5 changes: 5 additions & 0 deletions src/material/form-field/form-field-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {MatLabel} from './label';
import {MatPlaceholder} from './placeholder';
import {MatPrefix} from './prefix';
import {MatSuffix} from './suffix';
import {MatFormFieldControl} from './form-field-control';


@NgModule({
Expand All @@ -27,6 +28,10 @@ import {MatSuffix} from './suffix';
MatPlaceholder,
MatPrefix,
MatSuffix,

// TODO(crisbeto): can be removed once `MatFormFieldControl`
// is turned into a selector-less directive.
MatFormFieldControl as any,
],
imports: [
CommonModule,
Expand Down
2 changes: 1 addition & 1 deletion src/material/form-field/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
export * from './form-field-module';
export * from './error';
export * from './form-field';
export * from './form-field-control';
export {MatFormFieldControl} from './form-field-control';
export * from './form-field-errors';
export * from './hint';
export * from './placeholder';
Expand Down