-
-
Save jaseflow/67d62617048757f8b87f to your computer and use it in GitHub Desktop.
lists controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "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