on 01-16-2021 6:22 PM
Dear Team,
I am following tutorial using business application studio and facing this below error. i tried to search the forum. got few threads however did not help me to resolve the issue.
no matter which method i tried, i keep getting syntax error saying 'getResourceBundle' is not part of model. I am sending "sap/ui/model/resource/ResourceModel" module. then i am setting the resourcemodel like below.
var rmodel = new ResourceModel( {
bundleName : "My.Learning.webmodule.i18n.i18n" } );
this.getView().setModel(rmodel,"i18n");
after that i am trying to read the resource bundle with below syntax.
var oBundle = this.getView().getModel("i18n").getResourceBundle();
after getModel("i18n"), after pressing dot, even context help is not showing the getResourceBundle method. Below is the full source code.
am I missing something ? Please help.
sap.ui.define([ "sap/ui/core/mvc/Controller", "sap/ui/model/resource/ResourceModel" ], /** * @param{typeof sap.ui.core.mvc.Controller}Controller */ function (Controller,ResourceModel) { "use strict";Hi Praveen,
The best pratice of creating resourceModel is in manifest.json under sap.ui5 -> models.
There is nothing wrong with the way you create resourceModel it's just that it is applicable only to the view.
Coming to your question, I tried the same at my end and everything works seamlees, there is nothing wrong. Are there any console errors?
Thanks
Prashil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
77 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.