Skip to content

Instantly share code, notes, and snippets.

@venkateshwarv
Created January 30, 2017 19:10
Show Gist options
  • Save venkateshwarv/d6a546b2487e998536d8ad541d28411a to your computer and use it in GitHub Desktop.
Save venkateshwarv/d6a546b2487e998536d8ad541d28411a to your computer and use it in GitHub Desktop.
// MdSnackBar Service
/**
* Places a new component as the content of the snack bar container.
*/
private _attachSnackbarContent<T>(component: ComponentType<T>,
container: MdSnackBarContainer,
overlayRef: OverlayRef): MdSnackBarRef<T> {
let portal = new ComponentPortal(component);
let contentRef = container.attachComponentPortal(portal);
return new MdSnackBarRef(contentRef.instance, container, overlayRef);
}
// CcSnackBar Service
private _attachSnackbarContent<T>(component: ComponentType<T>,
container: MdSnackBarContainer,
overlayRef: OverlayRef): MdSnackBarRef<T> {
let portal = new ComponentPortal(SnackbarComponent);
let contentRef = container.attachComponentPortal(portal);
return new MdSnackBarRef(contentRef.instance, container, overlayRef);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment