当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript core.EmbeddedViewRef类代码示例

本文整理汇总了TypeScript中@angular/core.EmbeddedViewRef的典型用法代码示例。如果您正苦于以下问题:TypeScript EmbeddedViewRef类的具体用法?TypeScript EmbeddedViewRef怎么用?TypeScript EmbeddedViewRef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了EmbeddedViewRef类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: setAttributes

 setAttributes(attrs: WormholeAttributes) {
   this.cachedAttrs = attrs;
   if (this.viewRef && attrs && typeof attrs === 'object') {
     Object.assign(this.viewRef.context, attrs);
     this.viewRef.markForCheck();
   }
 }
开发者ID:ng-vcl,项目名称:ng-vcl,代码行数:7,代码来源:wormhole-base.ts

示例2: ifLoader

  @Input() set ifLoader(loading: boolean) {
    console.log('ifLoader, loading : ', loading);

    if (loading) {
      // create and attach a loader to our viewContainer
      const factory = this.cfResolver.resolveComponentFactory(LoaderSpinnerComponent);
      this.loaderComponentRef = this.viewContainer.createComponent(factory);

      // remove any embedded view
      if (this.embeddedViewRef) {
        this.embeddedViewRef.destroy();
        this.embeddedViewRef = null;
      }
    } else {

      // remove any loader
      if (this.loaderComponentRef) {
        this.loaderComponentRef.destroy();
        this.loaderComponentRef = null;
      }

      // create and attach our embeddedView
      this.embeddedViewRef = this.viewContainer.createEmbeddedView(this.templateRef);
    }
  }
开发者ID:guillaumeLeRoy,项目名称:eritis_fe,代码行数:25,代码来源:if.directive.ts

示例3: connect

  connect(attrs?: WormholeAttributes, events?: string[], index?: number): Observable<WormholeEvent> {
    if (typeof attrs === 'object' && attrs) {
      this.cachedAttrs = attrs;
    }

    this.disconnect();
    this.viewRef = this.attach(this.templateRef, index);

    this.viewRef.onDestroy(() => {
      this.viewRef = undefined;
    });

    if (this.cachedAttrs && typeof this.cachedAttrs === 'object') {
      Object.assign(this.viewRef.context, this.cachedAttrs);
    }
    this.viewRef.detectChanges();
    return NEVER;
  }
开发者ID:ng-vcl,项目名称:ng-vcl,代码行数:18,代码来源:wormhole-base.ts

示例4: ngOnChanges

	// ---
	// PUBLIC METHODS.
	// ---

	// I get called when any of the input bindings are updated.
	public ngOnChanges( changes: SimpleChanges ) : void {

		// NOTE: Since this Directive uses an ATTRIBUTE-BASED SELECTOR, we know that the
		// ngOnChanges() life-cycle method will be called AT LEAST ONCE. As such, we can
		// be confident that the embedded view will be marked for changes at least once.
		// --
		// We also want to check the view for changes any time the input-binding is
		// changed. This gives the calling context a chance to drive changes based on a
		// single expression even when change-detection is limited.
		this.embeddedViewRef.detectChanges();

	}
开发者ID:bennadel,项目名称:JavaScript-Demos,代码行数:17,代码来源:bind-once.directive.ts

示例5:

	// I initialize the bind-once directive.
	constructor(
		templateRef: TemplateRef<void>,
		viewContainerRef: ViewContainerRef
		) {

		this.embeddedViewRef = viewContainerRef.createEmbeddedView( templateRef );
		// Since we want manual control over when the content of the view is checked,
		// let's immediately detach the view. This removes it from the change-detection
		// tree. Now, it will only be checked when we either re-attach it to the change-
		// detection tree or we explicitly call .detectChanges() (see ngOnChanges()).
		this.embeddedViewRef.detach();

	}
开发者ID:bennadel,项目名称:JavaScript-Demos,代码行数:14,代码来源:bind-once.directive.ts

示例6: ngOnChanges

  ngOnChanges(changes: { [key: string]: SimpleChange }) {
    if (changes['templateWrapper']) {
      if (this.embeddedViewRef) {
        this.embeddedViewRef.destroy();
      }

      this.embeddedViewRef = this.viewContainer.createEmbeddedView(
        this.templateWrapper, {
          value: this.value,
          row: this.row,
          column: this.column
        });
    }

    if (this.embeddedViewRef) {
      this.embeddedViewRef.context.value = this.value;
      this.embeddedViewRef.context.row = this.row;
      this.embeddedViewRef.context.column = this.column;
    }
  }
开发者ID:Alber70g,项目名称:angular2-data-table,代码行数:20,代码来源:TemplateWrapper.ts

示例7: ngOnDestroy

    ngOnDestroy() {
		this.view.destroy();
	}
开发者ID:SebaPucheta,项目名称:angular2-multiselect-dropdown,代码行数:3,代码来源:menu-item.ts


注:本文中的@angular/core.EmbeddedViewRef类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。