Angular UpgradeModule не может понизить рейтинг @Directive - PullRequest
1 голос
/ 20 февраля 2020

Я пытаюсь обойти невозможность понизить Angular 8 @Directive с помощью UpgradeModule.

У меня есть вложенный angular компонент материала, который необходимо подключить к cdkScrollable. Моя иерархия выглядит следующим образом:

<div class="some-class-that-allows-scroll"> <-- angularjs scrollable component
  <mat-form-field></mat-form-field> <-- angular 8 component that needs cdkScrollable on parent

Нет способа понизить директиву cdkScrollable для работы в angularjs, IE

<div cdkScrollable class="some-class-that-allows-scroll"> <-- Will not work in angularjs template
  <mat-form-field></mat-form-field>

, поскольку я не могу понизить cdkScrollable @directive Я пытался «обернуть» эту директиву в повторно используемый компонент angular 8, а затем понизить этот компонент.

IE: Angular 8 компонент:

import { Component } from '@angular/core';

@Component({
  selector: 'scroll-wrapper',
  templateUrl: './scroll.component.html',
  styleUrls: ['./scroll.component.scss']
})
export class ScrollWrapperComponent {

  constructor() { }

}

Шаблон:

<div cdkScrollable>
  <ng-content></ng-content>
</div>

При использовании этого пониженного компонента в angularjs шаблоне:

<scroll-wrapper>
  <div class="some-class-that-allows-scroll"> <-- angularjs scrollable component
    <mat-form-field></mat-form-field> <-- angular 8 component that needs cdkScrollable on parent
  </div>
</scroll-wrapper>

Однако при этом класс прокрутки и директива cdkScrollable не делают в конечном итоге на том же элементе. Есть ли способ создать компонент angular 8, который упаковывает другой компонент и применяет директиву cdkScrollable к тому же элементу, который упаковывается?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...