Your issue is that your code which uses the value of $scope.test
is called way too soon after $bind
. You need to give you application time to sync with Firebase, until that point you wont have any data.
The $bind
method returns a promise which will be resolved once the initial data is loaded from Firebase. Try something like this:
.controller('TestCtrl', ['$scope', 'syncData', '$routeParams', function($scope, syncData, $routeParams) {
syncData('tests/'+$routeParams.id).$bind($scope,'test').then(function () {
//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!');
}
}
});
}])