Forum Stats

  • 3,854,230 Users
  • 2,264,343 Discussions
  • 7,905,617 Comments

Discussions

Binding nested components?

Venkata Rahul S
Venkata Rahul S Member Posts: 37 Blue Ribbon

I am using a drawer layout to create a standardized UI across multiple applications so that the navigation and UX patterns are identical.

The drawer layout however comes with a catch. The main content is part of the layout itself and therefore the knockout bindings must be called for the drawer layout (and the main content) in the same bootstrap whenDocumentReady() promise resolution. However, the application page may choose to apply bindings at a different point of the execution, over which I have no control.

The question therefore is how to approach the bindings for the drawer and for the content area at different points of execution? Any pointers from the cookbook or actual usage in applications can be of immense help..

Thanks in advance,

Rahul

Tagged:

Answers

  • John 'JB' Brock-Oracle
    John 'JB' Brock-Oracle Posts: 2,845 Employee
    edited Apr 28, 2022 9:15PM

    Do you have a sample app that shows the structure you're talking about Rahul?

    There should only be one ko.applyBindings() call in your application, and that usually happens in the main.js file for a JET starter template based project.

    When you say "across multiple applications" are these really completely different apps? If they are, the will not share the same app level context. About the only thing you could possibly do is use JavaScript events to dispatch and listen across the apps.

  • Venkata Rahul S
    Venkata Rahul S Member Posts: 37 Blue Ribbon

    Let me experiment a little more please. I will have some more scenarios