I have an angular service shown below :
.service('shareDataService', function() {
var myXi = [];
var myYi = [];
var addXi = function(newObj) {
myXi = newObj;
}
var addYi = function(newObj) {
myYi = newObj;
}
var getPlot = function() {
var a = [];
for (var i = 0; i < myXi.length; i++) {
a.push([myXi[i], myYi[i]]);
}
return a;
}
return {
addXi: addXi,
addYi: addYi,
getPlot: getPlot
};
});
And i have angular controller :
.controller('plotController', function($scope, shareDataService) {
$scope.getYo = function() {
return shareDataService.getPlot();
};
$scope.lineChartData = [
$scope.getYo()
];
});
I need to send a value from $scope.getYo to $scope.lineChartData (it will be and array). How can I do that? I've tried like that, but if I call $scope.lineChartData in HTML, I get nothing. The data that I need is
[
[
[2,0],
[3,1],
[5,4]
]
];
UPDATE :
See my complete explanation in http://laravel.io/bin/6LVej . Thanks