refactor: fix undecorated classes with angular features in repo (#36921)
A few instances of undecorated classes with Angular features have been discovered in the framework repo. This commit fixes those. PR Close #36921
This commit is contained in:
parent
0577bf0e3e
commit
e17fe90aaa
|
@ -3,6 +3,7 @@ import {
|
|||
AfterContentInit,
|
||||
AfterViewChecked,
|
||||
AfterViewInit,
|
||||
Directive,
|
||||
DoCheck,
|
||||
OnChanges,
|
||||
OnDestroy,
|
||||
|
@ -15,7 +16,8 @@ import { LoggerService } from './logger.service';
|
|||
let nextId = 1;
|
||||
|
||||
// #docregion ngOnInit
|
||||
export class PeekABoo implements OnInit {
|
||||
@Directive()
|
||||
export class PeekABooDirective implements OnInit {
|
||||
constructor(private logger: LoggerService) { }
|
||||
|
||||
// implement OnInit's `ngOnInit` method
|
||||
|
@ -34,7 +36,7 @@ export class PeekABoo implements OnInit {
|
|||
})
|
||||
// Don't HAVE to mention the Lifecycle Hook interfaces
|
||||
// unless we want typing and tool support.
|
||||
export class PeekABooComponent extends PeekABoo implements
|
||||
export class PeekABooComponent extends PeekABooDirective implements
|
||||
OnChanges, OnInit, DoCheck,
|
||||
AfterContentInit, AfterContentChecked,
|
||||
AfterViewInit, AfterViewChecked,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {OnDestroy, OnInit} from '@angular/core';
|
||||
import {Directive, OnDestroy, OnInit} from '@angular/core';
|
||||
|
||||
import {FormGroup} from '../model';
|
||||
|
||||
|
@ -23,6 +23,7 @@ import {AsyncValidatorFn, ValidatorFn} from './validators';
|
|||
*
|
||||
* @publicApi
|
||||
*/
|
||||
@Directive()
|
||||
export class AbstractFormGroupDirective extends ControlContainer implements OnInit, OnDestroy {
|
||||
/**
|
||||
* @description
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
*/
|
||||
|
||||
import {Location} from '@angular/common';
|
||||
import {Compiler, Injector, isDevMode, NgModuleFactoryLoader, NgModuleRef, NgZone, Type, ɵConsole as Console} from '@angular/core';
|
||||
import {BehaviorSubject, defer, EMPTY, Observable, of, Subject, Subscription} from 'rxjs';
|
||||
import {Compiler, Injectable, Injector, isDevMode, NgModuleFactoryLoader, NgModuleRef, NgZone, Type, ɵConsole as Console} from '@angular/core';
|
||||
import {BehaviorSubject, EMPTY, Observable, of, Subject, Subscription} from 'rxjs';
|
||||
import {catchError, filter, finalize, map, switchMap, tap} from 'rxjs/operators';
|
||||
|
||||
import {QueryParamsHandling, Route, Routes, standardizeConfig, validateConfig} from './config';
|
||||
|
@ -288,6 +288,7 @@ function defaultRouterHook(snapshot: RouterStateSnapshot, runExtras: {
|
|||
*
|
||||
* @publicApi
|
||||
*/
|
||||
@Injectable()
|
||||
export class Router {
|
||||
private currentUrlTree: UrlTree;
|
||||
private rawUrlTree: UrlTree;
|
||||
|
|
|
@ -7,12 +7,13 @@
|
|||
*/
|
||||
|
||||
import {ViewportScroller} from '@angular/common';
|
||||
import {OnDestroy} from '@angular/core';
|
||||
import {Injectable, OnDestroy} from '@angular/core';
|
||||
import {Unsubscribable} from 'rxjs';
|
||||
|
||||
import {NavigationEnd, NavigationStart, Scroll} from './events';
|
||||
import {Router} from './router';
|
||||
|
||||
@Injectable()
|
||||
export class RouterScroller implements OnDestroy {
|
||||
// TODO(issue/24571): remove '!'.
|
||||
private routerEventsSubscription!: Unsubscribable;
|
||||
|
|
|
@ -135,6 +135,7 @@ export class UpgradeNg1ComponentAdapterBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
@Directive()
|
||||
class UpgradeNg1ComponentAdapter implements OnInit, OnChanges, DoCheck {
|
||||
private controllerInstance: IControllerInstance|null = null;
|
||||
destinationObj: IBindingDestination|null = null;
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {DoCheck, ElementRef, EventEmitter, Injector, OnChanges, OnDestroy, OnInit, SimpleChanges, ɵlooseIdentical as looseIdentical} from '@angular/core';
|
||||
import {Directive, DoCheck, ElementRef, EventEmitter, Injector, OnChanges, OnDestroy, OnInit, SimpleChanges, ɵlooseIdentical as looseIdentical} from '@angular/core';
|
||||
|
||||
import {IAttributes, IAugmentedJQuery, IDirective, IDirectivePrePost, IInjectorService, ILinkFn, IScope, ITranscludeFunction} from '../../src/common/src/angular1';
|
||||
import {IAttributes, IAugmentedJQuery, IDirective, IInjectorService, ILinkFn, IScope, ITranscludeFunction} from '../../src/common/src/angular1';
|
||||
import {$SCOPE} from '../../src/common/src/constants';
|
||||
import {IBindingDestination, IControllerInstance, UpgradeHelper} from '../../src/common/src/upgrade_helper';
|
||||
import {isFunction} from '../../src/common/src/util';
|
||||
|
@ -66,6 +66,7 @@ class Bindings {
|
|||
*
|
||||
* @publicApi
|
||||
*/
|
||||
@Directive()
|
||||
export class UpgradeComponent implements OnInit, OnChanges, DoCheck, OnDestroy {
|
||||
private helper: UpgradeHelper;
|
||||
|
||||
|
|
Loading…
Reference in New Issue