Reputation: 16337
I use sanckbar but its position is not on bottom
what could be the issue ?
git https://github.com/ashjha/snakebar
Upvotes: 0
Views: 9436
Reputation: 3694
Hope this will help you All :
import { MdSnackBar } from '@angular/material';
export class DemoStackOverflow{
constructor(
private snackBar: MdSnackBar
){}
showSnackBar(){
this.snackBar.open("Yes i am Coming", "Ok", {
duration: 9000
}
}
}
Upvotes: 2
Reputation: 1
Passing a ViewContainerRef to config will limit the snackbar to the same. You should pass config.viewContainerRef = null
. This will place the snackBar to the center of the page.
Upvotes: 0
Reputation: 86
When no code is provided, it's hard to check what's wrong. However, I'm using the MdSnackBar (still in development), and it's working for me.
First off, the "snackbar component" itself must be included, as well as "MdSnackBarConfig" using:
import { MdSnackBar, MdSnackBarConfig } from '@angular/material';
import { ViewContainerRef } from '@angular/core';
After this, we can create or initialize the snackbar item and our viewContainerRef in the constructor:
constructor(
private snackbar: MdSnackBar,
public viewContainerRef: ViewContainerRef,
) { }
Now we can call the snackbar to be showed whenever we want, using:
let config = new MdSnackBarConfig(this.viewContainerRef);
this.snackbar.open('Snackbar text', 'Ok', config);
Please see the github for more info and updates, since this is an initial version.
Hope this helps somewhat
Upvotes: 4