on 08-23-2016 9:33 AM
Hi all,
we built an SAPUI5 app on HCP and run it in a FLP. Now we are trying to get rid of its login screen by using the HCP userapi. I implemented a route to it in neo-app.js .
I initialize the model in my Login.controller.js like this:
onInit: function() { | ||
var oModelUserCurrent = new sap.ui.model.json.JSONModel("/services/userapi/currentUser"); | ||
var strUserName = oModelUserCurrent.getProperty("/name"); |
Sorry for continuing here, but the web editor had a problem in handling the code snippet I took from webide directly.
In the case above
oModelUserCurrent,getData() returns undefined
I checked oModelUserCurrent.oData in chrome debugger - it is empty.
strUserName is undefined as well.
Any helpfull proposals and ideas for solving this are very much appreciated.
Thanks and best regardes
Wolfgang
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Wolfgang,
This is the portal service space and your question should be in the UI5 space, however from an initial look in your question, you are creating a model and then immediately trying to get its data, before the model finished fetching the data from the server.
You should use oModelUserCurrent.attachRequestCompleted to read the data in your model.
JsDoc Report - SAP UI development Toolkit for HTML5 - API Reference - sap.ui.model.Model
Regards,
Guy
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.