There seems to be a confusion with $scope in my code. I have ng-hide/shows that use a variable in the top nav, controlled by "NavController". Inside an ng-view, controllers are linked via the app config function. The appointment setting functionality is handled by "AppointmentController" which has a page outside of the nav linked to it. Once certain steps are completed and you login, the appointment setting takes place within AppointmentController view. However, there is a part where -
EDIT - I just realized that the input below needs to be in a separate controller. When attached to NavController, I want apptLogin() to modify data in the main view which is managed by a different controller.
<input ng-controller="NavController" ng-click="apptLogin(email)" value="Login and Continue" class="btn btn-default pull-left" >
$scope.apptLogin = function(email){
$http({
method: 'POST',
data: {email: email},
url: '/common_includes/ajax/validateUser.php',
}).then(function successCallback(response) {
if(response.data.status == 0){
var login_message = '<div class="alert alert-danger" role="alert">'+response.data.message+'</div>';
$('#login_modal .modal-body').html(login_message);
$('#login_modal').modal();
$interval(function(){
$('#login_modal').modal('hide');
}, 1400, 1);
}
if(response.data.status == 1){
$scope.appt_history = true;
console.log($scope);
var login_message = '<div class="alert alert-success" role="alert">'+response.data.message+'</div>';
$('#login_modal .modal-body').html(login_message);
$('#login_modal').modal();
$interval(function(){
$scope.click_login = false;
$('#login_modal').modal('hide');
}, 1400, 1);
}
The above code snippet should toggle the hide/show property, but it's not working as expected. -
$scope.appt_history = true;
I am confused because even though console.log($scope) shows that $scope.appt_history is true, the hide/show behavior doesn't change. What could I be missing here?