Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using UI hash key in an events hash

I am using marionette version 1.2.3 and backbone version 1.1.0

Here is my UI and events hash:

ui:{
    title : '#modelTypeTitle'
},
events:
{
    'change @ui.title' : 'validateTitle'
},

This seems to match what the documentation says: "You can also use the ui hash values from within events and trigger keys using the '@ui.elementName'"

To clarify I want to know why what I am trying above does not work. but the following works fine:

events:
{
    'change #modelTypeTitle' : 'validateTitle'
},
like image 840
Timigen Avatar asked Dec 18 '13 14:12

Timigen


1 Answers

Okay, problem solved after you showed version.

This feature, parsing @ui. syntax within the events and triggers hash, is recently added in 1.4.0 in early December. See changelog: https://github.com/marionettejs/backbone.marionette/blob/master/changelog.md

Just update your Marionette version to the latest stable(1.4.1 currently) and problem should be solved.

*I just noticed this new feature thanks to your question. I don't feel comfortable at this point before, now solved. Another evidence of helping others could also help the man himself. :)

like image 79
Billy Chan Avatar answered Oct 28 '22 12:10

Billy Chan