Skip to content

Commit 9cac963

Browse files
author
trik
committed
fix(cdk/overlay): add @Injectable to ConnectedOverlayPositionChange
* fix(cdk/overlay): add @Injectable to ConnectedOverlayPositionChange Since itls using an Optional decorator in constructor parameter, class ConnectedOverlayPositionChange needs to be decorated itself. build: noUndecoratedClassWithAngularFeaturesRule tslint rule does detect decorated constructor parameters
1 parent 69029b4 commit 9cac963

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

src/cdk/overlay/position/connected-position.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
/** Horizontal dimension of a connection point on the perimeter of the origin or overlay element. */
10-
import {Optional} from '@angular/core';
10+
import {Injectable, Optional} from '@angular/core';
1111
export type HorizontalConnectionPos = 'start' | 'center' | 'end';
1212

1313
/** Vertical dimension of a connection point on the perimeter of the origin or overlay element. */
@@ -86,6 +86,7 @@ export class ScrollingVisibility {
8686
isOverlayOutsideView: boolean;
8787
}
8888

89+
@Injectable()
8990
/** The change event emitted by the strategy when a fallback position is used. */
9091
export class ConnectedOverlayPositionChange {
9192
constructor(

tools/public_api_guard/cdk/overlay.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,17 @@ export class CloseScrollStrategy implements ScrollStrategy {
142142

143143
export { ComponentType }
144144

145-
// @public
145+
// @public (undocumented)
146146
export class ConnectedOverlayPositionChange {
147147
constructor(
148148
connectionPair: ConnectionPositionPair,
149149
scrollableViewProperties: ScrollingVisibility);
150150
connectionPair: ConnectionPositionPair;
151151
scrollableViewProperties: ScrollingVisibility;
152+
// (undocumented)
153+
static ɵfac: i0.ɵɵFactoryDeclaration<ConnectedOverlayPositionChange, [null, { optional: true; }]>;
154+
// (undocumented)
155+
static ɵprov: i0.ɵɵInjectableDeclaration<ConnectedOverlayPositionChange>;
152156
}
153157

154158
// @public
@@ -249,7 +253,7 @@ export class GlobalPositionStrategy implements PositionStrategy {
249253
width(value?: string): this;
250254
}
251255

252-
// @public
256+
// @public (undocumented)
253257
export type HorizontalConnectionPos = 'start' | 'center' | 'end';
254258

255259
// @public

tools/tslint-rules/noUndecoratedClassWithAngularFeaturesRule.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,15 @@ class Walker extends Lint.RuleWalker {
4747

4848
/** Checks if the specified node has an Angular decorator. */
4949
private _hasAngularDecorator(node: ts.Node): boolean {
50-
return !!node.decorators && node.decorators.some(d => {
50+
let decorators = node.decorators || [];
51+
if (ts.isConstructorDeclaration(node)) {
52+
node.parameters.forEach(param => {
53+
if (param.decorators) {
54+
decorators = [...decorators, ...param.decorators];
55+
}
56+
});
57+
}
58+
return decorators.some(d => {
5159
if (!ts.isCallExpression(d.expression) || !ts.isIdentifier(d.expression.expression)) {
5260
return false;
5361
}

0 commit comments

Comments
 (0)