mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
## Inheritance Semantics:
Decorators:
1) list the decorators of the class and its parents in the ancestor first order
2) only use the last decorator of each kind (e.g. @Component / ...)
Constructor parameters:
If a class inherits from a parent class and does not declare
a constructor, it inherits the parent class constructor,
and with it the parameter metadata of that parent class.
Lifecycle hooks:
Follow the normal class inheritance model,
i.e. lifecycle hooks of parent classes will be called
even if the method is not overwritten in the child class.
## Example
E.g. the following is a valid use of inheritance and it will
also inherit all metadata:
```
@Directive({selector: 'someDir'})
class ParentDirective {
constructor(someDep: SomeDep) {}
ngOnInit() {}
}
class ChildDirective extends ParentDirective {}
```
Closes #11606
Closes #12892
|
||
|---|---|---|
| .. | ||
| animation | ||
| aot | ||
| compiler_util | ||
| css_parser | ||
| expression_parser | ||
| i18n | ||
| ml_parser | ||
| output | ||
| schema | ||
| template_parser | ||
| view_compiler | ||
| directive_lifecycle_spec.ts | ||
| directive_normalizer_spec.ts | ||
| directive_resolver_mock_spec.ts | ||
| directive_resolver_spec.ts | ||
| metadata_overrider_spec.ts | ||
| metadata_resolver_fixture.ts | ||
| metadata_resolver_spec.ts | ||
| ng_module_resolver_mock_spec.ts | ||
| ng_module_resolver_spec.ts | ||
| pipe_resolver_mock_spec.ts | ||
| pipe_resolver_spec.ts | ||
| private_import_core.ts | ||
| resource_loader_mock_spec.ts | ||
| runtime_compiler_spec.ts | ||
| selector_spec.ts | ||
| shadow_css_spec.ts | ||
| spies.ts | ||
| style_url_resolver_spec.ts | ||
| url_resolver_spec.ts | ||
| util_spec.ts | ||