I would like to compare the variable
values of this two functions. Unfortunately I have tried to make the variables
global
but I keep getting undefined
.
'use strict';
/**
* @ngdoc function
* @name dashyAppApp.controller:Dashy3Ctrl
* @description
* # Dashy3Ctrl
* Controller of the dashyAppApp
*/
angular.module('dashyAppApp')
.controller('Dashy3Ctrl', function ($rootScope, $scope, employees, $interval) {
var _this = this;
$scope.getData = function() { // getDATA function
employees.getEmployees().then(function(response){
_this.items = response.data;
$scope.items = _this.items;
callmecrazy(response.data);
});
}// End getDATA function
$scope.getData();
$scope.getDataB = function() {
employees.getEmployees().then(function(response){
_this.items = response.data;
callmecrazier(response.data);
});
}
$interval(function(){
$scope.getDataB();
}, 10000);
function callmecrazier(response1){
callmecrazierVal = response1.countries;
return callmecrazierVal;
}
function callmecrazy(response){
callmecrazyVal = response.countries;
return callmecrazyVal;
}
if(!angular.equals(callmecrazierVal(), callmecrazyVal())) {
//trigger some other function
}
});
I want to check if callmecrazierVal !== callmecrazyVal
. That is my complete controller
code above.
if(callmecrazierVal !== callmecrazyVal){
//trigger some other function
}