2015-05-27 11:08:14 -04:00
|
|
|
library angular2.test.core.compiler.directive_lifecycle_spec;
|
|
|
|
|
2015-10-13 03:29:13 -04:00
|
|
|
import 'package:angular2/testing_internal.dart';
|
2016-01-06 17:13:44 -05:00
|
|
|
import 'package:angular2/src/compiler/directive_lifecycle_reflector.dart';
|
|
|
|
import 'package:angular2/src/core/metadata/lifecycle_hooks.dart';
|
2015-05-27 11:08:14 -04:00
|
|
|
|
|
|
|
main() {
|
|
|
|
describe('Create DirectiveMetadata', () {
|
|
|
|
describe('lifecycle', () {
|
refactor(lifecycle): prefix lifecycle methods with "ng"
BREAKING CHANGE:
Previously, components that would implement lifecycle interfaces would include methods
like "onChanges" or "afterViewInit." Given that components were at risk of using such
names without realizing that Angular would call the methods at different points of
the component lifecycle. This change adds an "ng" prefix to all lifecycle hook methods,
far reducing the risk of an accidental name collision.
To fix, just rename these methods:
* onInit
* onDestroy
* doCheck
* onChanges
* afterContentInit
* afterContentChecked
* afterViewInit
* afterViewChecked
* _Router Hooks_
* onActivate
* onReuse
* onDeactivate
* canReuse
* canDeactivate
To:
* ngOnInit,
* ngOnDestroy,
* ngDoCheck,
* ngOnChanges,
* ngAfterContentInit,
* ngAfterContentChecked,
* ngAfterViewInit,
* ngAfterViewChecked
* _Router Hooks_
* routerOnActivate
* routerOnReuse
* routerOnDeactivate
* routerCanReuse
* routerCanDeactivate
The names of lifecycle interfaces and enums have not changed, though interfaces
have been updated to reflect the new method names.
Closes #5036
2015-11-16 20:04:36 -05:00
|
|
|
describe("ngOnChanges", () {
|
|
|
|
it("should be true when the directive has the ngOnChanges method", () {
|
2015-10-20 12:38:14 -04:00
|
|
|
expect(hasLifecycleHook(
|
|
|
|
LifecycleHooks.OnChanges, DirectiveImplementingOnChanges))
|
2015-10-01 23:47:49 -04:00
|
|
|
.toBe(true);
|
2015-05-27 11:08:14 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it("should be false otherwise", () {
|
2015-10-20 12:38:14 -04:00
|
|
|
expect(hasLifecycleHook(LifecycleHooks.OnChanges, DirectiveNoHooks))
|
|
|
|
.toBe(false);
|
2015-05-27 11:08:14 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
refactor(lifecycle): prefix lifecycle methods with "ng"
BREAKING CHANGE:
Previously, components that would implement lifecycle interfaces would include methods
like "onChanges" or "afterViewInit." Given that components were at risk of using such
names without realizing that Angular would call the methods at different points of
the component lifecycle. This change adds an "ng" prefix to all lifecycle hook methods,
far reducing the risk of an accidental name collision.
To fix, just rename these methods:
* onInit
* onDestroy
* doCheck
* onChanges
* afterContentInit
* afterContentChecked
* afterViewInit
* afterViewChecked
* _Router Hooks_
* onActivate
* onReuse
* onDeactivate
* canReuse
* canDeactivate
To:
* ngOnInit,
* ngOnDestroy,
* ngDoCheck,
* ngOnChanges,
* ngAfterContentInit,
* ngAfterContentChecked,
* ngAfterViewInit,
* ngAfterViewChecked
* _Router Hooks_
* routerOnActivate
* routerOnReuse
* routerOnDeactivate
* routerCanReuse
* routerCanDeactivate
The names of lifecycle interfaces and enums have not changed, though interfaces
have been updated to reflect the new method names.
Closes #5036
2015-11-16 20:04:36 -05:00
|
|
|
describe("ngOnDestroy", () {
|
|
|
|
it("should be true when the directive has the ngOnDestroy method", () {
|
2015-10-20 12:38:14 -04:00
|
|
|
expect(hasLifecycleHook(
|
|
|
|
LifecycleHooks.OnDestroy, DirectiveImplementingOnDestroy))
|
2015-10-01 23:47:49 -04:00
|
|
|
.toBe(true);
|
2015-05-27 11:08:14 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it("should be false otherwise", () {
|
2015-10-20 12:38:14 -04:00
|
|
|
expect(hasLifecycleHook(LifecycleHooks.OnDestroy, DirectiveNoHooks))
|
|
|
|
.toBe(false);
|
2015-05-27 11:08:14 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
refactor(lifecycle): prefix lifecycle methods with "ng"
BREAKING CHANGE:
Previously, components that would implement lifecycle interfaces would include methods
like "onChanges" or "afterViewInit." Given that components were at risk of using such
names without realizing that Angular would call the methods at different points of
the component lifecycle. This change adds an "ng" prefix to all lifecycle hook methods,
far reducing the risk of an accidental name collision.
To fix, just rename these methods:
* onInit
* onDestroy
* doCheck
* onChanges
* afterContentInit
* afterContentChecked
* afterViewInit
* afterViewChecked
* _Router Hooks_
* onActivate
* onReuse
* onDeactivate
* canReuse
* canDeactivate
To:
* ngOnInit,
* ngOnDestroy,
* ngDoCheck,
* ngOnChanges,
* ngAfterContentInit,
* ngAfterContentChecked,
* ngAfterViewInit,
* ngAfterViewChecked
* _Router Hooks_
* routerOnActivate
* routerOnReuse
* routerOnDeactivate
* routerCanReuse
* routerCanDeactivate
The names of lifecycle interfaces and enums have not changed, though interfaces
have been updated to reflect the new method names.
Closes #5036
2015-11-16 20:04:36 -05:00
|
|
|
describe("ngOnInit", () {
|
|
|
|
it("should be true when the directive has the ngOnInit method", () {
|
2015-10-20 12:38:14 -04:00
|
|
|
expect(hasLifecycleHook(
|
|
|
|
LifecycleHooks.OnInit, DirectiveImplementingOnInit)).toBe(true);
|
2015-05-27 13:14:37 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it("should be false otherwise", () {
|
2015-10-20 12:38:14 -04:00
|
|
|
expect(hasLifecycleHook(LifecycleHooks.OnInit, DirectiveNoHooks))
|
|
|
|
.toBe(false);
|
2015-05-27 13:14:37 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
refactor(lifecycle): prefix lifecycle methods with "ng"
BREAKING CHANGE:
Previously, components that would implement lifecycle interfaces would include methods
like "onChanges" or "afterViewInit." Given that components were at risk of using such
names without realizing that Angular would call the methods at different points of
the component lifecycle. This change adds an "ng" prefix to all lifecycle hook methods,
far reducing the risk of an accidental name collision.
To fix, just rename these methods:
* onInit
* onDestroy
* doCheck
* onChanges
* afterContentInit
* afterContentChecked
* afterViewInit
* afterViewChecked
* _Router Hooks_
* onActivate
* onReuse
* onDeactivate
* canReuse
* canDeactivate
To:
* ngOnInit,
* ngOnDestroy,
* ngDoCheck,
* ngOnChanges,
* ngAfterContentInit,
* ngAfterContentChecked,
* ngAfterViewInit,
* ngAfterViewChecked
* _Router Hooks_
* routerOnActivate
* routerOnReuse
* routerOnDeactivate
* routerCanReuse
* routerCanDeactivate
The names of lifecycle interfaces and enums have not changed, though interfaces
have been updated to reflect the new method names.
Closes #5036
2015-11-16 20:04:36 -05:00
|
|
|
describe("ngDoCheck", () {
|
|
|
|
it("should be true when the directive has the ngDoCheck method", () {
|
2015-10-20 12:38:14 -04:00
|
|
|
expect(hasLifecycleHook(
|
|
|
|
LifecycleHooks.DoCheck, DirectiveImplementingOnCheck)).toBe(true);
|
2015-05-27 13:14:37 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it("should be false otherwise", () {
|
2015-10-20 12:38:14 -04:00
|
|
|
expect(hasLifecycleHook(LifecycleHooks.DoCheck, DirectiveNoHooks))
|
|
|
|
.toBe(false);
|
2015-05-27 13:14:37 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
refactor(lifecycle): prefix lifecycle methods with "ng"
BREAKING CHANGE:
Previously, components that would implement lifecycle interfaces would include methods
like "onChanges" or "afterViewInit." Given that components were at risk of using such
names without realizing that Angular would call the methods at different points of
the component lifecycle. This change adds an "ng" prefix to all lifecycle hook methods,
far reducing the risk of an accidental name collision.
To fix, just rename these methods:
* onInit
* onDestroy
* doCheck
* onChanges
* afterContentInit
* afterContentChecked
* afterViewInit
* afterViewChecked
* _Router Hooks_
* onActivate
* onReuse
* onDeactivate
* canReuse
* canDeactivate
To:
* ngOnInit,
* ngOnDestroy,
* ngDoCheck,
* ngOnChanges,
* ngAfterContentInit,
* ngAfterContentChecked,
* ngAfterViewInit,
* ngAfterViewChecked
* _Router Hooks_
* routerOnActivate
* routerOnReuse
* routerOnDeactivate
* routerCanReuse
* routerCanDeactivate
The names of lifecycle interfaces and enums have not changed, though interfaces
have been updated to reflect the new method names.
Closes #5036
2015-11-16 20:04:36 -05:00
|
|
|
describe("ngAfterContentInit", () {
|
|
|
|
it("should be true when the directive has the ngAfterContentInit method",
|
2015-10-20 12:38:14 -04:00
|
|
|
() {
|
|
|
|
expect(hasLifecycleHook(LifecycleHooks.AfterContentInit,
|
|
|
|
DirectiveImplementingAfterContentInit)).toBe(true);
|
2015-08-28 21:11:04 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it("should be false otherwise", () {
|
2015-10-20 12:38:14 -04:00
|
|
|
expect(hasLifecycleHook(
|
|
|
|
LifecycleHooks.AfterContentInit, DirectiveNoHooks)).toBe(false);
|
2015-08-28 21:11:04 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
refactor(lifecycle): prefix lifecycle methods with "ng"
BREAKING CHANGE:
Previously, components that would implement lifecycle interfaces would include methods
like "onChanges" or "afterViewInit." Given that components were at risk of using such
names without realizing that Angular would call the methods at different points of
the component lifecycle. This change adds an "ng" prefix to all lifecycle hook methods,
far reducing the risk of an accidental name collision.
To fix, just rename these methods:
* onInit
* onDestroy
* doCheck
* onChanges
* afterContentInit
* afterContentChecked
* afterViewInit
* afterViewChecked
* _Router Hooks_
* onActivate
* onReuse
* onDeactivate
* canReuse
* canDeactivate
To:
* ngOnInit,
* ngOnDestroy,
* ngDoCheck,
* ngOnChanges,
* ngAfterContentInit,
* ngAfterContentChecked,
* ngAfterViewInit,
* ngAfterViewChecked
* _Router Hooks_
* routerOnActivate
* routerOnReuse
* routerOnDeactivate
* routerCanReuse
* routerCanDeactivate
The names of lifecycle interfaces and enums have not changed, though interfaces
have been updated to reflect the new method names.
Closes #5036
2015-11-16 20:04:36 -05:00
|
|
|
describe("ngAfterContentChecked", () {
|
|
|
|
it("should be true when the directive has the ngAfterContentChecked method",
|
2015-10-20 12:38:14 -04:00
|
|
|
() {
|
|
|
|
expect(hasLifecycleHook(LifecycleHooks.AfterContentChecked,
|
|
|
|
DirectiveImplementingAfterContentChecked)).toBe(true);
|
2015-05-27 11:08:14 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it("should be false otherwise", () {
|
2015-10-20 12:38:14 -04:00
|
|
|
expect(hasLifecycleHook(
|
|
|
|
LifecycleHooks.AfterContentChecked, DirectiveNoHooks))
|
2015-10-01 23:47:49 -04:00
|
|
|
.toBe(false);
|
2015-05-27 11:08:14 -04:00
|
|
|
});
|
|
|
|
});
|
2015-08-28 21:11:04 -04:00
|
|
|
|
refactor(lifecycle): prefix lifecycle methods with "ng"
BREAKING CHANGE:
Previously, components that would implement lifecycle interfaces would include methods
like "onChanges" or "afterViewInit." Given that components were at risk of using such
names without realizing that Angular would call the methods at different points of
the component lifecycle. This change adds an "ng" prefix to all lifecycle hook methods,
far reducing the risk of an accidental name collision.
To fix, just rename these methods:
* onInit
* onDestroy
* doCheck
* onChanges
* afterContentInit
* afterContentChecked
* afterViewInit
* afterViewChecked
* _Router Hooks_
* onActivate
* onReuse
* onDeactivate
* canReuse
* canDeactivate
To:
* ngOnInit,
* ngOnDestroy,
* ngDoCheck,
* ngOnChanges,
* ngAfterContentInit,
* ngAfterContentChecked,
* ngAfterViewInit,
* ngAfterViewChecked
* _Router Hooks_
* routerOnActivate
* routerOnReuse
* routerOnDeactivate
* routerCanReuse
* routerCanDeactivate
The names of lifecycle interfaces and enums have not changed, though interfaces
have been updated to reflect the new method names.
Closes #5036
2015-11-16 20:04:36 -05:00
|
|
|
describe("ngAfterViewInit", () {
|
|
|
|
it("should be true when the directive has the ngAfterViewInit method",
|
2015-10-20 12:38:14 -04:00
|
|
|
() {
|
|
|
|
expect(hasLifecycleHook(LifecycleHooks.AfterViewInit,
|
|
|
|
DirectiveImplementingAfterViewInit)).toBe(true);
|
2015-08-28 21:11:04 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it("should be false otherwise", () {
|
2015-10-20 12:38:14 -04:00
|
|
|
expect(hasLifecycleHook(
|
|
|
|
LifecycleHooks.AfterViewInit, DirectiveNoHooks)).toBe(false);
|
2015-08-28 21:11:04 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
refactor(lifecycle): prefix lifecycle methods with "ng"
BREAKING CHANGE:
Previously, components that would implement lifecycle interfaces would include methods
like "onChanges" or "afterViewInit." Given that components were at risk of using such
names without realizing that Angular would call the methods at different points of
the component lifecycle. This change adds an "ng" prefix to all lifecycle hook methods,
far reducing the risk of an accidental name collision.
To fix, just rename these methods:
* onInit
* onDestroy
* doCheck
* onChanges
* afterContentInit
* afterContentChecked
* afterViewInit
* afterViewChecked
* _Router Hooks_
* onActivate
* onReuse
* onDeactivate
* canReuse
* canDeactivate
To:
* ngOnInit,
* ngOnDestroy,
* ngDoCheck,
* ngOnChanges,
* ngAfterContentInit,
* ngAfterContentChecked,
* ngAfterViewInit,
* ngAfterViewChecked
* _Router Hooks_
* routerOnActivate
* routerOnReuse
* routerOnDeactivate
* routerCanReuse
* routerCanDeactivate
The names of lifecycle interfaces and enums have not changed, though interfaces
have been updated to reflect the new method names.
Closes #5036
2015-11-16 20:04:36 -05:00
|
|
|
describe("ngAfterViewChecked", () {
|
|
|
|
it("should be true when the directive has the ngAfterViewChecked method",
|
2015-10-20 12:38:14 -04:00
|
|
|
() {
|
|
|
|
expect(hasLifecycleHook(LifecycleHooks.AfterViewChecked,
|
|
|
|
DirectiveImplementingAfterViewChecked)).toBe(true);
|
2015-08-28 21:11:04 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it("should be false otherwise", () {
|
2015-10-20 12:38:14 -04:00
|
|
|
expect(hasLifecycleHook(
|
|
|
|
LifecycleHooks.AfterViewChecked, DirectiveNoHooks)).toBe(false);
|
2015-08-28 21:11:04 -04:00
|
|
|
});
|
|
|
|
});
|
2015-05-27 11:08:14 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2015-05-29 13:42:47 -04:00
|
|
|
class DirectiveNoHooks {}
|
2015-05-27 11:08:14 -04:00
|
|
|
|
2015-08-28 00:19:56 -04:00
|
|
|
class DirectiveImplementingOnChanges implements OnChanges {
|
refactor(lifecycle): prefix lifecycle methods with "ng"
BREAKING CHANGE:
Previously, components that would implement lifecycle interfaces would include methods
like "onChanges" or "afterViewInit." Given that components were at risk of using such
names without realizing that Angular would call the methods at different points of
the component lifecycle. This change adds an "ng" prefix to all lifecycle hook methods,
far reducing the risk of an accidental name collision.
To fix, just rename these methods:
* onInit
* onDestroy
* doCheck
* onChanges
* afterContentInit
* afterContentChecked
* afterViewInit
* afterViewChecked
* _Router Hooks_
* onActivate
* onReuse
* onDeactivate
* canReuse
* canDeactivate
To:
* ngOnInit,
* ngOnDestroy,
* ngDoCheck,
* ngOnChanges,
* ngAfterContentInit,
* ngAfterContentChecked,
* ngAfterViewInit,
* ngAfterViewChecked
* _Router Hooks_
* routerOnActivate
* routerOnReuse
* routerOnDeactivate
* routerCanReuse
* routerCanDeactivate
The names of lifecycle interfaces and enums have not changed, though interfaces
have been updated to reflect the new method names.
Closes #5036
2015-11-16 20:04:36 -05:00
|
|
|
ngOnChanges(_) {}
|
2015-05-27 11:08:14 -04:00
|
|
|
}
|
|
|
|
|
2015-08-28 00:19:56 -04:00
|
|
|
class DirectiveImplementingOnCheck implements DoCheck {
|
refactor(lifecycle): prefix lifecycle methods with "ng"
BREAKING CHANGE:
Previously, components that would implement lifecycle interfaces would include methods
like "onChanges" or "afterViewInit." Given that components were at risk of using such
names without realizing that Angular would call the methods at different points of
the component lifecycle. This change adds an "ng" prefix to all lifecycle hook methods,
far reducing the risk of an accidental name collision.
To fix, just rename these methods:
* onInit
* onDestroy
* doCheck
* onChanges
* afterContentInit
* afterContentChecked
* afterViewInit
* afterViewChecked
* _Router Hooks_
* onActivate
* onReuse
* onDeactivate
* canReuse
* canDeactivate
To:
* ngOnInit,
* ngOnDestroy,
* ngDoCheck,
* ngOnChanges,
* ngAfterContentInit,
* ngAfterContentChecked,
* ngAfterViewInit,
* ngAfterViewChecked
* _Router Hooks_
* routerOnActivate
* routerOnReuse
* routerOnDeactivate
* routerCanReuse
* routerCanDeactivate
The names of lifecycle interfaces and enums have not changed, though interfaces
have been updated to reflect the new method names.
Closes #5036
2015-11-16 20:04:36 -05:00
|
|
|
ngDoCheck() {}
|
2015-05-27 13:14:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
class DirectiveImplementingOnInit implements OnInit {
|
refactor(lifecycle): prefix lifecycle methods with "ng"
BREAKING CHANGE:
Previously, components that would implement lifecycle interfaces would include methods
like "onChanges" or "afterViewInit." Given that components were at risk of using such
names without realizing that Angular would call the methods at different points of
the component lifecycle. This change adds an "ng" prefix to all lifecycle hook methods,
far reducing the risk of an accidental name collision.
To fix, just rename these methods:
* onInit
* onDestroy
* doCheck
* onChanges
* afterContentInit
* afterContentChecked
* afterViewInit
* afterViewChecked
* _Router Hooks_
* onActivate
* onReuse
* onDeactivate
* canReuse
* canDeactivate
To:
* ngOnInit,
* ngOnDestroy,
* ngDoCheck,
* ngOnChanges,
* ngAfterContentInit,
* ngAfterContentChecked,
* ngAfterViewInit,
* ngAfterViewChecked
* _Router Hooks_
* routerOnActivate
* routerOnReuse
* routerOnDeactivate
* routerCanReuse
* routerCanDeactivate
The names of lifecycle interfaces and enums have not changed, though interfaces
have been updated to reflect the new method names.
Closes #5036
2015-11-16 20:04:36 -05:00
|
|
|
ngOnInit() {}
|
2015-05-27 13:14:37 -04:00
|
|
|
}
|
|
|
|
|
2015-05-27 11:08:14 -04:00
|
|
|
class DirectiveImplementingOnDestroy implements OnDestroy {
|
refactor(lifecycle): prefix lifecycle methods with "ng"
BREAKING CHANGE:
Previously, components that would implement lifecycle interfaces would include methods
like "onChanges" or "afterViewInit." Given that components were at risk of using such
names without realizing that Angular would call the methods at different points of
the component lifecycle. This change adds an "ng" prefix to all lifecycle hook methods,
far reducing the risk of an accidental name collision.
To fix, just rename these methods:
* onInit
* onDestroy
* doCheck
* onChanges
* afterContentInit
* afterContentChecked
* afterViewInit
* afterViewChecked
* _Router Hooks_
* onActivate
* onReuse
* onDeactivate
* canReuse
* canDeactivate
To:
* ngOnInit,
* ngOnDestroy,
* ngDoCheck,
* ngOnChanges,
* ngAfterContentInit,
* ngAfterContentChecked,
* ngAfterViewInit,
* ngAfterViewChecked
* _Router Hooks_
* routerOnActivate
* routerOnReuse
* routerOnDeactivate
* routerCanReuse
* routerCanDeactivate
The names of lifecycle interfaces and enums have not changed, though interfaces
have been updated to reflect the new method names.
Closes #5036
2015-11-16 20:04:36 -05:00
|
|
|
ngOnDestroy() {}
|
2015-05-27 11:08:14 -04:00
|
|
|
}
|
|
|
|
|
2015-08-28 21:11:04 -04:00
|
|
|
class DirectiveImplementingAfterContentInit implements AfterContentInit {
|
refactor(lifecycle): prefix lifecycle methods with "ng"
BREAKING CHANGE:
Previously, components that would implement lifecycle interfaces would include methods
like "onChanges" or "afterViewInit." Given that components were at risk of using such
names without realizing that Angular would call the methods at different points of
the component lifecycle. This change adds an "ng" prefix to all lifecycle hook methods,
far reducing the risk of an accidental name collision.
To fix, just rename these methods:
* onInit
* onDestroy
* doCheck
* onChanges
* afterContentInit
* afterContentChecked
* afterViewInit
* afterViewChecked
* _Router Hooks_
* onActivate
* onReuse
* onDeactivate
* canReuse
* canDeactivate
To:
* ngOnInit,
* ngOnDestroy,
* ngDoCheck,
* ngOnChanges,
* ngAfterContentInit,
* ngAfterContentChecked,
* ngAfterViewInit,
* ngAfterViewChecked
* _Router Hooks_
* routerOnActivate
* routerOnReuse
* routerOnDeactivate
* routerCanReuse
* routerCanDeactivate
The names of lifecycle interfaces and enums have not changed, though interfaces
have been updated to reflect the new method names.
Closes #5036
2015-11-16 20:04:36 -05:00
|
|
|
ngAfterContentInit() {}
|
2015-08-28 21:11:04 -04:00
|
|
|
}
|
|
|
|
|
2015-08-28 00:19:56 -04:00
|
|
|
class DirectiveImplementingAfterContentChecked implements AfterContentChecked {
|
refactor(lifecycle): prefix lifecycle methods with "ng"
BREAKING CHANGE:
Previously, components that would implement lifecycle interfaces would include methods
like "onChanges" or "afterViewInit." Given that components were at risk of using such
names without realizing that Angular would call the methods at different points of
the component lifecycle. This change adds an "ng" prefix to all lifecycle hook methods,
far reducing the risk of an accidental name collision.
To fix, just rename these methods:
* onInit
* onDestroy
* doCheck
* onChanges
* afterContentInit
* afterContentChecked
* afterViewInit
* afterViewChecked
* _Router Hooks_
* onActivate
* onReuse
* onDeactivate
* canReuse
* canDeactivate
To:
* ngOnInit,
* ngOnDestroy,
* ngDoCheck,
* ngOnChanges,
* ngAfterContentInit,
* ngAfterContentChecked,
* ngAfterViewInit,
* ngAfterViewChecked
* _Router Hooks_
* routerOnActivate
* routerOnReuse
* routerOnDeactivate
* routerCanReuse
* routerCanDeactivate
The names of lifecycle interfaces and enums have not changed, though interfaces
have been updated to reflect the new method names.
Closes #5036
2015-11-16 20:04:36 -05:00
|
|
|
ngAfterContentChecked() {}
|
2015-05-29 13:42:47 -04:00
|
|
|
}
|
2015-08-28 21:11:04 -04:00
|
|
|
|
|
|
|
class DirectiveImplementingAfterViewInit implements AfterViewInit {
|
refactor(lifecycle): prefix lifecycle methods with "ng"
BREAKING CHANGE:
Previously, components that would implement lifecycle interfaces would include methods
like "onChanges" or "afterViewInit." Given that components were at risk of using such
names without realizing that Angular would call the methods at different points of
the component lifecycle. This change adds an "ng" prefix to all lifecycle hook methods,
far reducing the risk of an accidental name collision.
To fix, just rename these methods:
* onInit
* onDestroy
* doCheck
* onChanges
* afterContentInit
* afterContentChecked
* afterViewInit
* afterViewChecked
* _Router Hooks_
* onActivate
* onReuse
* onDeactivate
* canReuse
* canDeactivate
To:
* ngOnInit,
* ngOnDestroy,
* ngDoCheck,
* ngOnChanges,
* ngAfterContentInit,
* ngAfterContentChecked,
* ngAfterViewInit,
* ngAfterViewChecked
* _Router Hooks_
* routerOnActivate
* routerOnReuse
* routerOnDeactivate
* routerCanReuse
* routerCanDeactivate
The names of lifecycle interfaces and enums have not changed, though interfaces
have been updated to reflect the new method names.
Closes #5036
2015-11-16 20:04:36 -05:00
|
|
|
ngAfterViewInit() {}
|
2015-08-28 21:11:04 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
class DirectiveImplementingAfterViewChecked implements AfterViewChecked {
|
refactor(lifecycle): prefix lifecycle methods with "ng"
BREAKING CHANGE:
Previously, components that would implement lifecycle interfaces would include methods
like "onChanges" or "afterViewInit." Given that components were at risk of using such
names without realizing that Angular would call the methods at different points of
the component lifecycle. This change adds an "ng" prefix to all lifecycle hook methods,
far reducing the risk of an accidental name collision.
To fix, just rename these methods:
* onInit
* onDestroy
* doCheck
* onChanges
* afterContentInit
* afterContentChecked
* afterViewInit
* afterViewChecked
* _Router Hooks_
* onActivate
* onReuse
* onDeactivate
* canReuse
* canDeactivate
To:
* ngOnInit,
* ngOnDestroy,
* ngDoCheck,
* ngOnChanges,
* ngAfterContentInit,
* ngAfterContentChecked,
* ngAfterViewInit,
* ngAfterViewChecked
* _Router Hooks_
* routerOnActivate
* routerOnReuse
* routerOnDeactivate
* routerCanReuse
* routerCanDeactivate
The names of lifecycle interfaces and enums have not changed, though interfaces
have been updated to reflect the new method names.
Closes #5036
2015-11-16 20:04:36 -05:00
|
|
|
ngAfterViewChecked() {}
|
2015-08-28 21:11:04 -04:00
|
|
|
}
|