@angular/cdk/portal#CdkPortalOutletAttachedRef TypeScript Examples

The following examples show how to use @angular/cdk/portal#CdkPortalOutletAttachedRef. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: step.component.ts    From ng-ant-admin with MIT License 6 votes vote down vote up
// 这么做完全是为了演示CDK portal的简单用法
  initComponent(ref: CdkPortalOutletAttachedRef): void {
    if (ref instanceof ComponentRef) {
      if (ref.instance instanceof StepOneComponent) {
        ref.instance.stepDirection = this.stepDirection;
        ref.instance.next.subscribe(() => {
          this.currentStep = this.currentStep + 1;
          ref.destroy();
          this.goStep(1);
        });
      }
      if (ref.instance instanceof StepTwoComponent) {
        ref.instance.previous.subscribe(() => {
          this.currentStep = this.currentStep - 1;
          ref.destroy();
          this.goStep(0);
        });
        ref.instance.next.subscribe(() => {
          this.currentStep = this.currentStep + 1;
          ref.destroy();
          this.goStep(2);
        });
      }
      if (ref.instance instanceof StepThreeComponent) {
        ref.instance.stepDirection = this.stepDirection;
        ref.instance.next.subscribe(() => {
          this.currentStep = 1;
          ref.destroy();
          this.goStep(0);
        });
      }
    }
  }