Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Module Require Load Recipe: binding with exported class and its members?

Venkata Rahul SMay 4 2022

I am referring to the Require Load recipe in the cookbook here
All the three modules here refer to their respective typescript exports, in their oj-bind-text value bindings.
Now if I had a class FirstView in the first module. how would I "marry" that to the view binding declarations? In other words, from the default instance of a class named FirstView in my viewModel class, I want to refer to say a string greeting.
How can I pass this FirstView reference in the following line:
<oj-bind-text value=[[FirestView.greeting]]/>
or
<oj-bind-text value=[[greeting]]/> ?
My FirstView.ts file, which is the viewModel in my moduleConfig is:
class FirstView{
greeting:ko.Observable<string> = ko.observable("Hello");
}
export new FirstView() as firstView();
Sub question:
When I declare the moduleCOnfig binding as done in the above recipe, is the FirstView class instantiated also? What I saw was that static lines are executed but the class itself is not instantiated unless the export new instance was specifically done.
Also, does the moduleConfig binding in this recipe automatically take care of executing the Promise and its callback (if any)?
Please help.

This post has been answered by Venkata Rahul S on May 5 2022
Jump to Answer

Comments

Post Details

Added on May 4 2022
2 comments
83 views