simple example using the data-connectors

27 views
Skip to first unread message

Clark Lin

unread,
Jul 17, 2017, 9:51:27 AM7/17/17
to Terrific
hi i have a structure like

<div mod mod-wrapper-authenticate>
        <div mod mod-document-requirements-entry></div>
        <div mod mod-document-requirements-entry></div>        

       ...some radio buttons
</div>

in my wrapper-authenticate.js 
...
on: function(callback) {
            var self = this;
            var $ctx = this.$ctx;

            $('.content-card-declaration input[type=radio]').bind('click', function(){
                if($(this).val() == "accept"){
                    self.fire('changeMood', {mood:'perfect'});
                }
                else if($(this).val() == "decline"){         
                    /*do something when decline is clicked*/
                }
            });            
            
            callback();
        }

Inside document-requirements-entry.js...
i want to listen for this 'changedMood' event, 

Question, where do i put the data-connectors=?
next to mod-wrapper-authenticate?
or next to mod-document-requirements-entry

and also how do i listen for 'changedMood' inside document-requirements-entry.js
like so?

        on: function(callback) {
            var self = this;
            var $ctx = this.$ctx;                                    
            callback();

           changeMood: function(data){
               alert("Hi: " + data.mood);
           }
        }
   
       
thanks


Reply all
Reply to author
Forward
0 new messages