Show TOC

Instantiating a Resource ModelLocate this document in the navigation structure

The resource model is used as a wrapper for resource bundles. In data binding you use the resource model instance, for example, to bind texts of a control to language-dependent resource bundle properties.


A resource model is instantiated with a bundleName or a bundleURL. The bundle name is the name of the resource bundle and equals a SAPUI5 module name within the require/declare concept. The bundle URL points to a resource bundle. If you use the bundle name, the file must have the .properties suffix. If you do not specify a locale, the system uses the login language: var oModel = new sap.ui.model.resource.ResourceModel({bundleName:"myBundle",locale:"en"});
In this resource model implementation you cannot pass parameters to your texts within the resource bundle. If you have to pass parameters, you must do this on your own. Therefore, you can load the bundle yourself or retrieve it from the model.
var myBundle = oModel.getResourceBundle();

After the resource model has been instantiated, you have a model containing the resource bundle texts as data.