Reputation: 1391
Is it possible to use some config parameters from the manifest.json in a view or controller within sapui5?
E.g. in my Component.js I can write smth like:
console.log(this.getMetadata().getManifestEntry("sap.app"));
I would like to access the ManifestEntry from my detail view (JS) because I specified the name of my model in the manifest. Until now I call my model in the view directly with:
this.getModel("dummyModel")
But I believe it would be better to call it indirectly so I don't have to change the string everywhere in case I wanna change the model name. E.g:
this.getModel(PLEASEHELP.getManifestEntry("sap.app").myModel);
Upvotes: 2
Views: 2564
Reputation: 3948
You can access the component from a controller via getOwnerComponent():
this.getOwnerComponent().getManifestEntry("sap.app").myModel
Upvotes: 6