MdDialog message undefined error

142 views
Skip to first unread message

gallowa...@gmail.com

unread,
Jul 27, 2017, 12:40:29 AM7/27/17
to angular-material2
I recently updated Angular from version 4 to 4.3.1 and updated to angular material 2.0.0-beta.8

before the update my dialog was working, now I am getting this error as soon as i open the dialog using this code

        let dialogConfirmationRef = self.dialog.open(DialogConfirmation, {
            disableClose: true,
            data: data
        });

this is the error in the console which is in a infinite loop


core.es5.js:1020 ERROR TypeError: Cannot read property 'message' of undefined at Object.eval [as updateRenderer] (DialogConfirmation.ngfactory.js:53) at Object.updateRenderer (core.es5.js:12722) at checkAndUpdateView (core.es5.js:12241) at callViewAction (core.es5.js:12601) at execComponentViewsAction (core.es5.js:12533) at checkAndUpdateView (core.es5.js:12242) at callViewAction (core.es5.js:12601) at execEmbeddedViewsAction (core.es5.js:12559) at checkAndUpdateView (core.es5.js:12237) at callViewAction (core.es5.js:12601)

when i click on the link to js:53 and put a breakpoint it is complaining that data is undefined

this is the code line

var currVal_1 = _co.data.message;

is this a known issue or has the way you open the dialog changed with the new version?

Thanks,
Mike

gallowa...@gmail.com

unread,
Jul 27, 2017, 12:58:23 AM7/27/17
to angular-material2
when i look at my previous working version the _co.data.message is the data i am injecting into the dialog, so it seems that they have changed the way you inject data to the dialog?

gallowa...@gmail.com

unread,
Jul 27, 2017, 6:45:47 PM7/27/17
to angular-material2
found the solution, you have to use MD_DIALOG_DATA now to access the injected data.

Reply all
Reply to author
Forward
0 new messages