on 2016 Aug 18 9:39 AM
Hi,
Iam working in sap ui5 , i am facing problem while adding the external js file in component.js .But its not finding the files.
Below shows the folder structure
jQuery.sap.includeScript("sap/ui/demo/masterdetail/util/Utility");
jQuery.sap.includeScript("sap/ui/demo/masterdetail/util/JOB");
jQuery.sap.includeScript("sap/ui/demo/masterdetail/util/globalvariables");
jQuery.sap.includeScript("sap/ui/demo/masterdetail/util/DecodeWorker");
jQuery.sap.includeScript("sap/ui/demo/masterdetail/util/exif");
As shown above i am trying to add thes files externally. I am getting an error as shown below.
encapsulate the external js as module
example: JOB.js
jQuery.sap.declare(''nampace.JOB')
//PUT YOUR JOB.JS CODE HERE
when u want to use it
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you can load it in index.html and register as new module in Component.js like
jQuery.sap.registerModulePath(
'SignaturePad'
,
'SignaturePad'
);
here SignaturePad is external file.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
You can try like this. Hope this helps.
sap.ui.define([
"sap/ui/core/UIComponent",
"sap/ui/Device",
"sap/ui/demo/masterdetail/util/Utility"
], function(UIComponent, Device, Utility) {
"use strict";
return UIComponent.extend("sap.ui.demo.masterdetail.Component", {
metadata: {
manifest: "json",
},
/**
* The component is initialized by UI5 automatically during the startup of the app and calls the init method once.
* @public
* @override
*/
init: function() {
// call the base component's init function
UIComponent.prototype.init.apply(this, arguments);
this.setModel(models.createDeviceModel(), "device");
},
});
});
Add your js file path inside the sap.ui.define.
Thanks and regards
Indrajith
User | Count |
---|---|
81 | |
11 | |
10 | |
10 | |
10 | |
8 | |
7 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.