Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : can.Component external events

$
0
0
You probably want to use two way binding between component scopes.

parent-container scope should have selected attribute:

can.Component({
      tag: parent-container 
      template: '
            '<notes-list selected="selected"></notes-list>' +
            '<note-editor selected="selected"></note-editor>',
      
      scope: {
            selected: 1 // some initial value (for example ID) of selected note 
      }
})

After init both notes-list and note-editor will have selected attribute equal to 1.
And as attributes two-way bound you change selected value say in notes-list it will be updated in parent-container and sequentially in note-editor.


Viewing all articles
Browse latest Browse all 3491

Trending Articles