Ti.include and passing data oddity
I have a method that loads a page:
...
formList: function(data) {
... code here ...
}
...
The data argument is passed correctly and the code inside the function can use it. However if I do:
...
formList: function(data) {
Ti.include('someFile.js');
}
...
Then it's no longer usable. "var data cannot be found".
What am I missing?
2 Answers
-
Does the problem persist if
someFile.js
is empty? (ie see if you can rule out a conflict with the contents of that file) -
Yes. I've removed everything and tried just the same before.
It's odd because any vars that are defined INSIDE the function will work.
So if I reassign the argument:
formList: function(data) { var weirdProblem = data; Ti.include('someFile.js'); }
It'll work.
Also, I did forget to mention the include is referencing a file a directory back. so it's more like Ti.include('../views/someFile.js'); I only mention that because I've seen Ti.include do weird things in the past