cancel
Showing results for 
Search instead for 
Did you mean: 

proplem with Variables in Controller

0 Kudos

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

Accepted Solutions (0)

Answers (3)

Answers (3)

Valeck
Participant

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.

0 Kudos

You Can create global variable in onInit method.

onInit:function(){

this.myGlobalVariable;

}

onAfterRendering:function(){

this.myGlobalVariable;

}

junwu
Active Contributor
0 Kudos

this.YOURVARIABLE=

you can use it in your controller method.