Thanood / aurelia-mdl-skeleton-navigation

A fork of aurelia-skeleton-navigation, using Material Design Lite.
MIT License
4 stars 2 forks source link

mdl-toast problem #17

Open egeland opened 8 years ago

egeland commented 8 years ago

I'm trying to use the mdl-toast like the below, but am getting errors:

import {inject} from 'aurelia-framework';
import {MdlToastService} from './aurelia-mdl/mdl-toast';

@inject(MdlToastService)
export class Home {
    constructor(toastService) {
        this.toastService = toastService;
    }
    toastMe() {
        this.toastService.notify('Test Toast');
    }
}

I have a button with a simple click.trigger="toastMe()" - that is all in reference to toast in my HTML. Am I simply missing something?

The error I get is:

Uncaught TypeError: Cannot read property 'showSnackbar' of undefined
notify @ mdl-toast.js:15
toastMe @ home.js:10
evaluate @ aurelia-binding.js:1345
callSource @ aurelia-binding.js:4724
(anonymous function) @ aurelia-binding.js:4749
Thanood commented 8 years ago

Last time I checked, mdl doesn't export its MaterialSnackbar class (which has the showSnackbar method). I'm wondering if I should work around that or wait until they release it officially..

egeland commented 8 years ago

Probably better to wait..

EvgenyAGM commented 8 years ago

Is there any way to fix it? It doesn't seem to work yet :(

Thanood commented 7 years ago

I just got a notification from this (very old) issue today and I don't know why. 😏 If there's still interest, I can add a toast example tomorrow.

cvrnogueira commented 7 years ago

@Thanood I wrote that i still have problem with the toast, to see if someone post the answer here, but the problem was with Vue, but coincidentally it was exactly the same error, so i erase the post after i found out hahha. Thanks a lot anyway!

Thanood commented 7 years ago

Thanks for telling me.. I'm notoriously curious.