Apparently this is not supported by Angular Material (according to v1.1.0.rc1) with screens less than 960px wide, but we can have a workaround like this:
<body ng-app="myApp"> <div layout-fill> <md-toolbar ng-cloak> <div class="md-toolbar-tools"> <md-button>My app</md-button> </div> </md-toolbar> <div id="toaster"></div> <md-content id="content" ng-cloak> ... </md-content> </div> </body>
CSS
#toaster { position: fixed; top: 56px; height: 48px; left: 0; width: 100%; z-index: 10000; }
JS:
$mdToast.show($mdToast.simple() .textContent('hello!') .parent(document.querySelectorAll('#toaster')) .position('top left') .hideDelay(false) .action('x'));
Result: http://screencast.com/t/B1U8aXaFcd
It will also keep the toast in position when the page scrolls. But with this solution, the animated seam will continue to move the message to the bottom, not the top. In my real project, I did not fight with MD and had a toast at the bottom, but I use this approach to maintain my position when scrolling through the page.
Artem vasiliev
source share