Reputation: 606
I am having a serious issue. I am building an sencha touch app using cordova build(using sencha cmd5). In Sencha the AppName.app.globalVarible is working fine, but after build the global variable in no more accessible in cordova. Here the code is as follows.
Global variable(baseUrl
) code in app.js
.
Ext.application({
name: 'Myapp',
baseUrl: 'http://localhost/myproject/admin',
.............
This is working fine when i call this global variable baseUrl by Myapp.app.baseUrl
in sencha app. (I mean in the browser)
But when i run sencha app build native
(using cordova build)
then i am getting the following error.
Uncaught TypeError: Cannot read property 'baseUrl' of undefined
(near Myapp.app.baseUrl).
Please don't tell me to change it to util. i don't want it.
Please help regarding the same. Thank You
Upvotes: 1
Views: 408
Reputation: 105
I don't know what's the issue here, but you can do one thing here and it'll work for sure. Instead of defining a variable in app.js
, try this:
Create a new js file and named it global.js
.(NOT IN APP FOLDER)
Create a desired variable in global.js
.In your case,
var global = { baseUrl: 'http://localhost/myproject/admin' }
Now add this global file reference in index.html
.
Now whenever you want baseUrl, just write global.baseUrl
Upvotes: 2