@angular/material/menu#MAT_MENU_SCROLL_STRATEGY TypeScript Examples

The following examples show how to use @angular/material/menu#MAT_MENU_SCROLL_STRATEGY. 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: tour-anchor-opener.component.ts    From ngx-ui-tour with MIT License 6 votes vote down vote up
@Component({
  providers: [{
    provide: MAT_MENU_SCROLL_STRATEGY,
    useFactory: scrollFactory,
    deps: [Overlay, NgxmTourService]
  }],
  selector: 'tour-anchor-opener',
  styles: [
    `
            :host {
                display: none;
            }
        `
  ],
  template: `
        <span [matMenuTriggerFor]="menu" [matMenuTriggerRestoreFocus]="false" #trigger="matMenuTrigger"></span>
    `
})
export class TourAnchorOpenerComponent {
  @Input() menu: MatMenu = new MatMenu(undefined, undefined, {
    xPosition: 'after',
    yPosition: 'below',
    overlapTrigger: true,
    backdropClass: ''
  });

  @ViewChild(MatMenuTrigger) public trigger: MatMenuTrigger;
}
Example #2
Source File: tutorial-trigger.directive.ts    From bdc-walkthrough with MIT License 5 votes vote down vote up
constructor(private ngZone: NgZone,
              private tutorialService: BdcWalkService,
              private __overlay: Overlay, private __elementRef: ElementRef<HTMLElement>, private __dir: Directionality,
              __viewContainerRef: ViewContainerRef, __focusMonitor: FocusMonitor,
              @Inject(MAT_MENU_SCROLL_STRATEGY) private __scrollStrategy) {

    super(__overlay, __elementRef, __viewContainerRef, __scrollStrategy, null, null, __dir, __focusMonitor);
  }