Difficult to reproduce, so I will try to explain instead.
Within a factory of angularjs I have a function like this
angular.module('my').factory('Database', ['$window', 'Raw', function($window, Raw) {
return {
read: function() {
where Raw is another factory defined below that returns a data string
Then I do this:
var lines = [];
lines = Raw.data.split("*");
which gives me an array of strings.
The strange behaviour is that it gives an error as lines[0] is undefined. I can solve this error by adding an alert
var lines = [];
lines = Raw.data.split("*");
alert(lines[0])
which shows me the expected string. But it does not work if I put a console.log command instead.
So, what's going on??
Cheers,
Raw.datacode