on 11-12-2021 8:28 AM
hello every one
I have question About variables im Controller file
for example How can I use the same variable that I defined in onInt: function in onAfterRendering:function?
or how i can defined public variable?
because when I Alwayes use the Variable in onAfterRendering that in onInt defined i got error Undefind
hi,
u can define a global variables, example:
function (Controller) {
"use strict";
var scpId;
return Controller.extend("test.test.controller.applic", {
onInit: function () {
scpId = <value>;
},
onAfterRendering: function () {
var var2 = scpId;
},
I hope it will be of help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You Can create global variable in onInit method.
onInit:function(){
this.myGlobalVariable;
}
onAfterRendering:function(){
this.myGlobalVariable;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
this.YOURVARIABLE=
you can use it in your controller method.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
69 | |
8 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.