I need to transfer data from the function B and function A. Here is the code
This is function A
$scope.OneWeekData = function () {
var days = 7;
$scope.getChart(days);
};
This is function B
$scope.vm = {};
var getJunkData = false;
$scope.vm.myClick = function ($event) {
if ($event == true) {
getJunkData = $event;
$scope.OneWeekData(days)
} else {
getJunkData = $event;
$scope.OneWeekData()
}
};
And this is function C
var params = {};
$scope.getChart = function (days, from, to) {};
The flow of the process should go like this, I have a chart in HTML, and for each chart have buttons for display ranges, one week, two weeks etc ... I also have check boxes where you can choose whether to only displays of purified and adequate data or Renderer and wrong data. Now, now it works in a way that the user can click on any of the date ranges and receive data in the chart. If you checked the checkbox, and then click on one of the date ranges, gets no purified data, and other way around. I want to get to if the user has selected daterange for example, two weeks, and if checked checkbox are automatically displayed with dates preselected daterangeom. Example, the first call function B, vm.myClick ($ event) to check whether the checkiran checkbox, and if true we call the function A, and after the function A fill DAYS, calls the main function of C.
Since I have separate functions for different date ranges
$scope.OneMonthData = function () {
var days = 30;
$scope.getChart(days);
};
$scope.threeMonthsData = function () {
var days = 90;
$scope.getChart(days);
};
$scope.allData = function () {
var days = 360;
$scope.getChart(days);
};
$scope.getDateRange = function () {
var from = $scope.ctrl.picker4.date;
var to = $scope.ctrl.picker5.date;
$scope.getChart(null, from, to);
};
How dynamic remember who daterange selected, so if we chose 60 days that you click the check box, automatically as a function of B fill days from the selected function A,
I hope you understand, thank you
EDIT: maybe a little simplistic question, when you click on one of the date ranges, to fill the variable that is globally accessible. And at every click when clicked another button daterange, empty variable and fill up with new days of this clicked on daterange. And that these days are available in the function B
You can simply assign a variable in $scope and pass it on.
Suppose:
$scope.dataYouNeedToPass = {} //initialize in the controller
function A(){
$scope.dataYouNeedToPass = setNewValue(); //do whatever manipulation you need to do
}
function B(){
var getNewValue = $scope.dataYouNeedToPass; // use it in another function
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With