Skip to content

fix: annotate a couple base classes with @Directive for Ivy #17022

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

Closed
wants to merge 2 commits 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
16 changes: 16 additions & 0 deletions src/cdk/portal/portal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import {
EmbeddedViewRef,
Injector,
ComponentFactoryResolver,
Directive,
NgModule,
} from '@angular/core';
import {
throwNullPortalOutletError,
Expand Down Expand Up @@ -179,6 +181,13 @@ export type PortalHost = PortalOutlet;
* Partial implementation of PortalOutlet that handles attaching
* ComponentPortal and TemplatePortal.
*/
@Directive({
// The @Directive with selector is required here because the CDK is still based on Angular 8.x.
// In Angular 9.x, `@Directive()` without any selector is legal (and `BasePortalModule` is not
// necessary either).
// TODO(alxhub): convert to a selectorless Directive when the CDK upgrades to Angular 9.
selector: 'do-not-use-abstract-base-portal-outlet',
})
export abstract class BasePortalOutlet implements PortalOutlet {
/** The portal currently attached to the host. */
protected _attachedPortal: Portal<any> | null;
Expand Down Expand Up @@ -260,6 +269,13 @@ export abstract class BasePortalOutlet implements PortalOutlet {
}
}

// TODO(alxhub): remove when `BasePortalOutlet` becomes a selectorless Directive.
@NgModule({
declarations: [BasePortalOutlet as any],
})
export class DoNotUseBasePortalOutletModule {
}

/**
* @deprecated Use `BasePortalOutlet` instead.
* @breaking-change 9.0.0
Expand Down
15 changes: 15 additions & 0 deletions src/material/form-field/form-field-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,18 @@
*/

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


/** An interface which allows a control to work inside of a `MatFormField`. */
@Directive({
// The @Directive with selector is required here because Material is still based on Angular 8.x.
// In Angular 9.x, `@Directive()` without any selector is legal (and `MatFormFieldControlModule`
// is not necessary either).
// TODO(alxhub): convert to a selectorless Directive when Material upgrades to Angular 9.
selector: 'do-not-use-abstract-mat-form-field-control',
})
export abstract class MatFormFieldControl<T> {
/** The value of the control. */
value: T | null;
Expand Down Expand Up @@ -67,3 +75,10 @@ export abstract class MatFormFieldControl<T> {
/** Handles a click on the control's container. */
abstract onContainerClick(event: MouseEvent): void;
}

// TODO(alxhub): remove when `MatFormFieldControl` becomes a selectorless Directive.
@NgModule({
declarations: [MatFormFieldControl as any],
})
export class DoNotUseMatFormFieldControlModule {
}