$ionicActionSheet with Firebase buttons throwing error


#1

So I am trying to make an action sheet that creates buttons from a list of firebase entries. However, the code below returns the error: Error: scope.buttons is undefined.

$scope.actionSheet = function() {
        console.log($scope.buttonList);
        $ionicActionSheet.show({
            buttons: $scope.buttons,
            titleText: 'Select a Child...',
            cancelText: 'Cancel',
            cancel: function() {
                // add cancel code..
            },
            buttonClicked: function(index) {
                var id = buttonList[index].id;
                $scope.currentChild = id;
                return true;
            }
        });
    };
(this function is run by an ng-click in a controller).
$user.profile.$loaded().then(function() {
     for (var item in $user.profile.child) {
        console.log(item);
        var newText = baseIt(item);
        $scope.buttons.push(newText);
        console.log($scope.buttons);
    }
});

If anyone has any better, working way of doing this, please let me know!


#2

more code needed to be able to provide a better answer