Adding a custom library as a dependency in SAP Fiori

主宰稳场 提交于 2019-11-28 19:58:51

In your Fiori App:

  1. Put your dependencie into the app descriptor (manifest.json) (or if no app descriptor used into the config inside the Component.js)

    dependencies: {
        libs: ["sap.m", "sap.ui.layout", "com.foo.library"],
        components: [com.foo.component]
    }
    
  2. Let sap.ui.core know where to search for the namespace of your library.(Top of your Component.js)

    jQuery.sap.registerModulePath("com.foo", "/Path/on/the/server/");
    

And now you can use your dependencies. And here is why:

Before a module is loaded, the longest registered prefix of its module name is searched for and the associated URL prefix is used as a prefix for the request URL. The remainder of the module name is attached to the request URL by replacing dots ('.') with slashes ('/').

The registration and search operates on full name segments only.

Source: SAP UI5 API Documentation

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!