-
-
Save katowulf/631c8189ec9c240448e2 to your computer and use it in GitHub Desktop.
Example of utilizing flattened data for this gg discussion https://groups.google.com/forum/#!topic/firebase-angular/UEI1WugYPUI
This file contains 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
// list my portfolios | |
var userId = 'kato'; | |
var ref = new Firebase('.../portfolios/'+userId); | |
var portfolioList = $firebase(ref).$asArray(); | |
// add a new column | |
$scope.addColumn = function(portfolio, newColumnName) { | |
portfolio.columns[newColumnName] = true; | |
portfolioList.$save(portfolio); | |
}; | |
// remove a column | |
$scope.removeColumn = function(portfolio, oldColumnName) { | |
delete portfolio.columns[oldColumnName]; | |
portfolioList.$save(portfolio); | |
}; | |
// fetch data for a portfolio | |
$scope.getPortfolioData = function(portfolio) { | |
var ref = new Firebase('.../portfolio_data').child(portfolio.$id); | |
$scope.data = $firebase(ref).$asObject(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment