Topggle on select

This commit is contained in:
Max Lynch
2013-10-07 01:12:09 -05:00
parent 02a540b468
commit 35f487b7fb
3 changed files with 6 additions and 5 deletions

View File

@ -308,6 +308,7 @@ angular.module('ionic.ui.sideMenu', [])
}); });
$scope.contentTranslateX = 0; $scope.contentTranslateX = 0;
$scope.sideMenuCtrl = this; $scope.sideMenuCtrl = this;
}) })

View File

@ -123,6 +123,9 @@ angular.module('ionic.todo.controllers', ['ionic.todo'])
}; };
$scope.clearActive(); $scope.clearActive();
project.isActive = true; project.isActive = true;
// Close the side menu
$scope.sideMenuCtrl.toggleLeft();
}; };
$scope.clearActive = function() { $scope.clearActive = function() {
@ -151,8 +154,6 @@ angular.module('ionic.todo.controllers', ['ionic.todo'])
var np = $scope.projects.add(p); var np = $scope.projects.add(p);
np.setPriority(-(+new Date)); np.setPriority(-(+new Date));
$scope.setActiveProject(np); $scope.setActiveProject(np);
$scope.sideMenuCtrl.toggleLeft();
}; };
var projectsRef = new Firebase(FIREBASE_URL + '/project_list'); var projectsRef = new Firebase(FIREBASE_URL + '/project_list');
@ -166,14 +167,12 @@ angular.module('ionic.todo.controllers', ['ionic.todo'])
} }
} }
}); });
projectsRef.on('child_added', function(snapshot, prevChildName) { projectsRef.once('child_added', function(snapshot, prevChildName) {
if(prevChildName === null) {
$scope.setActiveProject( $scope.setActiveProject(
angular.extend({ angular.extend({
'$ref': snapshot.ref(), '$ref': snapshot.ref(),
}, snapshot.val()) }, snapshot.val())
) )
}
}); });
}) })

View File

@ -29,6 +29,7 @@ angular.module('ionic.ui.sideMenu', [])
}); });
$scope.contentTranslateX = 0; $scope.contentTranslateX = 0;
$scope.sideMenuCtrl = this; $scope.sideMenuCtrl = this;
}) })