fix(ivy): detect ngOnChanges as a non-static method (#24862)

Previously ngtsc had a bug where it would only detect the presence of
ngOnChanges as a static method. This commit flips the condition and only
recognizes ngOnChanges as a non-static method.

PR Close #24862
This commit is contained in:
Alex Rickabaugh
2018-07-12 14:52:29 -07:00
committed by Victor Berchet
parent 5d7005eef5
commit 6f8ec256ef

View File

@ -127,9 +127,9 @@ export function extractDirectiveMetadata(
const host = extractHostBindings(directive, decoratedElements, reflector, checker, coreModule);
// Determine if `ngOnChanges` is a lifecycle hook defined on the component.
const usesOnChanges = members.find(
member => member.isStatic && member.kind === ClassMemberKind.Method &&
member.name === 'ngOnChanges') !== undefined;
const usesOnChanges = members.some(
member => !member.isStatic && member.kind === ClassMemberKind.Method &&
member.name === 'ngOnChanges');
// Detect if the component inherits from another class
const usesInheritance = clazz.heritageClauses !== undefined &&