Skip to content

Instantly share code, notes, and snippets.

@jaseflow
Created August 21, 2015 03:04
Show Gist options
  • Select an option

  • Save jaseflow/67d62617048757f8b87f to your computer and use it in GitHub Desktop.

Select an option

Save jaseflow/67d62617048757f8b87f to your computer and use it in GitHub Desktop.
lists controller
"use strict";
app.controller("ListCtrl", function($scope, $stateParams, $firebaseObject) {
var ref = new Firebase("https://psi-dashboard.firebaseio.com/lists"),
activeList = $stateParams.listName;
$scope.lists = $firebaseObject(ref);
$scope.results = $firebaseObject(ref.child(activeList));
$scope.activeList = activeList;
$scope.dataLoaded = false;
// Let the UI know when the data has loaded
ref.once("value", function() {
$scope.dataLoaded = true;
});
$scope.displayType = "list";
$scope.toggleView = function() {
if($scope.displayType === "list") {
$scope.displayType = "grid";
}
else {
$scope.displayType = "list";
}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment