im new to AngularJS. I have this kind of program in Controller File.
.controller('AppCtrl', function($scope, $ionicPopup, $timeout, $ionicModal, $state, $http, $ionicLoading) {
var loginid;// globally Defined
$scope.ajaxLogin = function(){
loginid = 1;
}
$scope.myInfo = function(){
alert(loginid);
}
})
but everytime i call myInfo() function Alert gives me : undefined
in my program ajaxLogin() will call first. then if only button clicked myInfo() will call and alert will be displayed. in Normal Javascript it work fine. but not sure how to work with angularjs.
ex :
var globalvarialbe;
function function1()
{
globalvarialbe=12;
}
function function2()
{
var local = globalvarialbe;
}