on 09-23-2017 11:58 PM
Hi ui5 experts,
I am new to sap ui5 and working on sap web IDE demo version.
This is bellow an application I am working on. Basically what I want to do is very simple. Let's say we have a custom js function called hello() defined in "myApp_toto/tools/date.js" file and I want to call this hello function in the controller Address.controller.js, this controller triggers my function hello() when a button called "sayHello" is clicked on. The button sayHello is defined in the Address.js.view
I've tried many things with dependencies sap.ui.define(...), Query.sap.registerModulePath(), sap.ui.require(), but still not working.
If you faced the same issue or have any good solution, please share !
Thank you.
I got it worked using UMD format in my library.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
First of all, PLEASE do not develop with JS view, use XML. This is the best practice recommanded by SAP !
Secondly, did you register your library into the manifest.json?
Regards
Joseph
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rahul,
Thank you for your reply.
Here is my view where the button that triggers hello() function is defined.
Here is my controller where the dependency named moment is injected:
Here is my module moment.js where dispResult is defined:
In debugging this what I am getting when button is clicked on: ==> my dipsResult is not recognized:
moment.js file is loaded but its content is still not accessible from my controller.
any other idea is welcom.
thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Below is one such example from Fiori Master Detail App template:
Here models.js is defined inside model folder and this js file contains one function createDeviceModel, which is returned in a JavaScript object.
Now in component.js file the models.js file is loaded with asynchronous module defination and called as below:
Here sap.ui.demo.masterdetail is the namespace of app (root).
Regards,
Rahul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
11 | |
10 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.