fix(ivy): objects like ElementRef should not use a special injection fn (#26064)

PR Close #26064
This commit is contained in:
Kara Erickson
2018-09-21 18:38:13 -07:00
parent 482e12c940
commit 6a62ed2245
56 changed files with 1367 additions and 1073 deletions

View File

@ -6,6 +6,8 @@
* found in the LICENSE file at https://angular.io/license
*/
import {R3_ELEMENT_REF_FACTORY} from '../ivy_switch/runtime/index';
/**
* A wrapper around a native element inside of a View.
*
@ -46,4 +48,7 @@ export class ElementRef<T = any> {
public nativeElement: T;
constructor(nativeElement: T) { this.nativeElement = nativeElement; }
/** @internal */
static __NG_ELEMENT_ID__: () => ElementRef = () => R3_ELEMENT_REF_FACTORY(ElementRef);
}

View File

@ -6,6 +6,8 @@
* found in the LICENSE file at https://angular.io/license
*/
import {R3_TEMPLATE_REF_FACTORY} from '../ivy_switch/runtime/index';
import {ElementRef} from './element_ref';
import {EmbeddedViewRef} from './view_ref';
@ -14,12 +16,12 @@ import {EmbeddedViewRef} from './view_ref';
* Represents an embedded template that can be used to instantiate embedded views.
* To instantiate embedded views based on a template, use the `ViewContainerRef`
* method `createEmbeddedView()`.
*
*
* Access a `TemplateRef` instance by placing a directive on an `<ng-template>`
* element (or directive prefixed with `*`). The `TemplateRef` for the embedded view
* is injected into the constructor of the directive,
* using the `TemplateRef` token.
*
*
* You can also use a `Query` to find a `TemplateRef` associated with
* a component or a directive.
*
@ -48,4 +50,8 @@ export abstract class TemplateRef<C> {
* @returns The new view object.
*/
abstract createEmbeddedView(context: C): EmbeddedViewRef<C>;
/** @internal */
static __NG_ELEMENT_ID__:
() => TemplateRef<any> = () => R3_TEMPLATE_REF_FACTORY(TemplateRef, ElementRef)
}

View File

@ -7,6 +7,8 @@
*/
import {Injector} from '../di/injector';
import {R3_VIEW_CONTAINER_REF_FACTORY} from '../ivy_switch/runtime/index';
import {ComponentFactory, ComponentRef} from './component_factory';
import {ElementRef} from './element_ref';
import {NgModuleRef} from './ng_module_factory';
@ -139,4 +141,8 @@ export abstract class ViewContainerRef {
* If not specified, the last view in the container is detached.
*/
abstract detach(index?: number): ViewRef|null;
/** @internal */
static __NG_ELEMENT_ID__:
() => ViewContainerRef = () => R3_VIEW_CONTAINER_REF_FACTORY(ViewContainerRef, ElementRef)
}