I am a beginner in this industry and I have a desire to create an app. However, I am facing some challenges at the moment. Below is a simplified version of my code. My goal is to have the API display only the signUp
option initially. Upon clicking on signUp
and then pressing submit
, I want the button to switch to display only signout
.
Currently, my scope variable is not functioning as intended and both buttons are being displayed. Can you please make the necessary modifications and explain the reason behind this issue? If possible, kindly utilize rootscope, scope, and sc.logIn() so that I can learn how to implement it correctly. Thank you!
https://plnkr.co/edit/ewhLZsKKTWTzlECsj4xO?p=preview
angular.module('myApp',['myApp.dashboard','myApp.signUp']);
angular.module('myApp.dashboard').controller('mainControl',mainControl);
mainControl.$inject = ['$rootScope','$scope'];
function mainControl($rootScope,$scope){
$rootScope.logged=false;
$scope.logged=$rootScope.logged;
}
angular.module('myApp.signUp').controller('signUpControl',signUpControl);
signUpControl.$inject = ['$rootScope','$scope'];
function signUpControl($rootScope){
alert("haha");
this.logIn=function(){
$rootScope.logged=true;
};
}