hello there,
i am trying to access manifest.json file through my Component.js(working) file but it is giving some path problem.
files structure
index.html
<!DOCTYPE HTML><html> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/> <script src="resources/sap-ui-core.js" id="sap-ui-bootstrap" data-sap-ui-libs="sap.m" data-sap-ui-theme="sap_bluecrystal" data-sap-ui-compatVersion="edge" data-sap-ui-xx-bindingSyntax="complex" > </script> <!-- only load the mobile lib "sap.m" and the "sap_bluecrystal" theme --> <script> sap.ui.localResources("mannifest"); sap.ui.getCore().attachInit(function (){ new sap.ui.core.ComponentContainer({ name : "mannifest" }).placeAt("content"); }); </script> </head> <body class="sapUiBody" role="application"> <div id="content"></div> </body></html>
Component.js
sap.ui.define([ "sap/ui/core/UIComponent", "sap/ui/model/json/JSONModel"
], function (UIComponent, JSONModel) { "use strict"; return UIComponent.extend("mannifest.Component", { //edit here metadata : { manifest:"json" //edit here }, init : function(){ console.log("init of component"); UIComponent.prototype.init.apply(this, arguments); var oData = { recipient : {name : "World"} }; var oModel = new JSONModel(oData); this.setModel(oModel); } });
});
manifest.json
{ "_version": "1.1.0", "sap.app": { "_version": "1.1.0", "id": "mannifest", //namespace "type": "application", "i18n": "mannifest/i18n/i18n.properties", //i18n file "title": "{{appTitle}}", "description": "{{appDescription}}", "applicationVersion": { "version": "1.0.0" }, "ach": "CA-UI5-DOC" }, "sap.ui": { "_version": "1.1.0", "technology": "UI5", "deviceTypes": { "desktop": true, "tablet": true, "phone": true }, "supportedThemes": [ "sap_bluecrystal" ] }, "sap.ui5": { "_version": "1.1.0", "rootView": "mannifest.main", //root view "dependencies": { "minUI5Version": "1.30", "libs": { "sap.m": {} } }, "models": { "i18n": { "type": "sap.ui.model.resource.ResourceModel", "settings": { "bundleName": "mannifest.i18n.i18n" //i18 file } } } }
}
main.view.xml
<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" controllerName="mannifest.main" xmlns:html="http://www.w3.org/1999/xhtml"> <Button text="{/recipient/name}"/> <Button text="hello"/></core:View>