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!

How to reference appController in a view, $root doesn't seem to work any longer?

User_IPNT8Feb 6 2020 — edited Feb 7 2020

Hi All,

All of my viewModels have the appController added so i can reference things by calling app.functionName() or app.variable just fine.

My issue is trying to reach up to this while in a view. For example, I have a listView where I want to format a particular field, so I created a function in the appController.

I am trying something like:

<oj-bind-text

value="[[$root.formattedTime($current.data.timeVariable)]]">

</oj-bind-text>


That doesnt work as it doesnt like $root. If I add the formattedTime function to the viewModel the view uses then it works:

<oj-bind-text

value="[[formattedTime($current.data.timeVariable)]]">

</oj-bind-text>

I want to avoid copying this function to all the viewModels that need it. I gather I am missing something simple here, but it has plagued me for a while!

Thanks for any help.

This post has been answered by Duncan Mills-Oracle on Feb 6 2020
Jump to Answer

Comments

At this point you just have the procedure in your editor.

Click the 'Compile' button in the editor toolbar, it will look like a set of sprockets/gears. This will send the 'Create or Replace...' statement to the database. You'll then be able to see the new object in your tree, although you might need to manually refresh the tree for the new object to appear.
1 - 1

Post Details

Added on Feb 6 2020
5 comments
179 views