-
Notifications
You must be signed in to change notification settings - Fork 25.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some fixes for @angular/core #16394
Some fixes for @angular/core #16394
Conversation
packages/core/src/view/provider.ts
Outdated
if (tokenKey === ChangeDetectorRefTokenKey) { | ||
// directives on the same element as a component should be able to control the change detector | ||
// of that component as well. | ||
allowPrivateServices = elDef && !!elDef.element !.componentView; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
normalize to boolean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
comp.counter = 1; | ||
cf.detectChanges(); | ||
expect(compEl.nativeElement).toHaveText('0'); | ||
dir.changeDetectorRef.markForCheck(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is dir.changeDetectorRef
in this case ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the changeDetectorRef
that the directive received. The test verifies that it cannot change mark the component on the parent element as being dirty.
const compRef = | ||
modRef.componentFactoryResolver.resolveComponentFactory(App).create(Injector.NULL); | ||
|
||
expect(getDOM().getAttribute(compRef.location.nativeElement, 'ng-version')).toBeFalsy(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you want hasAttribute
here, no ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
…Ref`. When a directive lives on the same element as a component (e.g. `<my-comp myDir>`), the directive was not able to get hold of the `ChangeDetectorRef` of the component on that element. However, as directives are supposed to decorate components, this is incorrect. This commit enables this use case. Closes angular#12816
Angular uses the `ng-version` attribute to indicate which elements were used to bootstrap an application. However, after 4.0 we also added this attribute for all dynamically created components. Fixes angular#15880
…Ref`. (#16394) When a directive lives on the same element as a component (e.g. `<my-comp myDir>`), the directive was not able to get hold of the `ChangeDetectorRef` of the component on that element. However, as directives are supposed to decorate components, this is incorrect. This commit enables this use case. Closes #12816
…Ref`. (#16394) When a directive lives on the same element as a component (e.g. `<my-comp myDir>`), the directive was not able to get hold of the `ChangeDetectorRef` of the component on that element. However, as directives are supposed to decorate components, this is incorrect. This commit enables this use case. Closes #12816
…Ref`. (angular#16394) When a directive lives on the same element as a component (e.g. `<my-comp myDir>`), the directive was not able to get hold of the `ChangeDetectorRef` of the component on that element. However, as directives are supposed to decorate components, this is incorrect. This commit enables this use case. Closes angular#12816
…ngular#16394) Angular uses the `ng-version` attribute to indicate which elements were used to bootstrap an application. However, after 4.0 we also added this attribute for all dynamically created components. Fixes angular#15880 PR Close angular#16394
…Ref`. (angular#16394) When a directive lives on the same element as a component (e.g. `<my-comp myDir>`), the directive was not able to get hold of the `ChangeDetectorRef` of the component on that element. However, as directives are supposed to decorate components, this is incorrect. This commit enables this use case. Closes angular#12816
…ngular#16394) Angular uses the `ng-version` attribute to indicate which elements were used to bootstrap an application. However, after 4.0 we also added this attribute for all dynamically created components. Fixes angular#15880 PR Close angular#16394
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
No description provided.