I want to do some simple string comparisons, calculations and filtering on my firebase data INSIDE MY CONTROLLER before I send it to the view. I can't seem to figure out how to access the data inside the firebase object.
here is my firebase object within 'tests/'+$routeParams.id:
{
"createdDate":"2014-03-30T18:04:28.927Z",
"modified":"2014-03-30T18:04:28.927Z",
"region":"shoulder",
"step1":{
"defined_incident":"no",
"localized_or_referred":"localized",
"recent_surgery":"no",
"symptoms":"constant"
},
"title":"testtest",
"user":"simplelogin:1"
}
here is my controller:
.controller('TestCtrl', ['$scope', 'syncData', '$routeParams', function($scope, syncData, $routeParams) {
syncData('tests/'+$routeParams.id).$bind($scope,'test');
//this is where i want to access $scope.test
//and check if $scope.test.region is equal to 'shoulder', etc.
if($scope.test.region.$value == 'shoulder') {
if($scope.test.step1.localized_or_referred.$value == 'localized') {
alert('Shoulder & Localized!');
}
}
}])
What am I missing here? I have also tried converting the firebase object to an array using the OrderByPriority filter, but without success.