I am building a simple web page signup form in Angular storing the data in Parse.
controller('AppCtrl', ['$scope', '$rootScope', function($scope, $rootScope) {
$rootScope.groupCreated = false;
$scope.signUp = function(form) {
var Group = Parse.Object.extend("AdminOrg");
var group = new Group();
group.set("groupName", form.name);
group.set("groupPassword", form.password);
group.save(null, {
success: function(data) {
$rootScope.groupCreated = true;
},
error: function(data, error) {
alert(error.message);
}
});
};
}]);
I am using $rootScope.groupCreated in my HTML to hide the signup form and show a "Group successfully created" message once the success function is called. The value is successfully being changed to true but it's not changing the html view. I am using the following to hide and show two divs:
ng-hide="$rootScope.groupCreated"
ng-show="$rootScope.groupCreated"
Am I accessing the $rootScope incorrectly in my HTML?
ng-hide="groupCreated"should be used