AngularFire: How to update scope without syncing to Firebase (i.e. local states, like "loading" or "selected")

I'm new to Firebase and AngularJS (and AngularFire), but am managing to work most things out... however this one's stumping me.

Situation:

I've got a server and a separate frontend. The frontend has NO WRITE PERMISSIONS for Firebase - it can only read it's own data (using a token provided by the server). The server has an API which the frontend utilises to make updates.

For the frontend to request an update to a particular item in a list, it needs to provide that item's Firebase ID to the server (along with whatever other information the API needs). The server will first verify that ID and then use it to update the correct Firebase data.

I've got AngularFire doing a three-way data binding for these actions, which is awesome!

Problem:

Lets say my Firebase structure is as follows:

actions: {
    -JFeuuEIFDh: { // Firebase IDs for arrays
        label: "One",
        .
        .
        .
    },
    -JfuDu2JC81: {
        "label": "Two",
        .
        .
        .
}

I have the following HTML:

<div ng-controller"SuperController">
    <ul>

        <!-- key is the Firebase ID for the action, which is
        required for my server to know which object to update -->
        <li ng-repeat="(key, action) in actions">

            <a ng-click="doAction(key, action)">action.label</a>

            <!-- **Loading IS NOT and SHOULD NOT be stored in Firebase,**
            it's simply a local state which AngularJS should manage -->
            <p ng-hide="!action.loading">Loading...</p>

        </li>
    </ul>
</div>

doAction looks something like this:

$scope.doAction = function(key, item) {
    $scope.actions[key].loading = true;

    var onComplete = function () {
        $scope.actions[key].loading = false;
    }


    // Calls to the server, etc...
    .
    .
    .
}

I'm using $scope.actions[key].loading to provide a local state so the "Loading..." paragraph will appear when the user initiates doAction, and disappear when the doAction logic completes.

However, because AngularFire has set up a three-way data binding, it tries to save that change to the database, which fails because the client does not have permission to write!

I don't want it to save loading to the database! It's there simply to update that paragraph's ng-hide - it shouldn't be persistent and there's no way this would justify providing write permission to the client.

So what am I supposed to do? I can't think of any way to update the scope without firing off the three-way binding... Am I thinking of this the wrong way?

EDIT

Nested deep in the AngularJS documentation, under $FirebaseObject.$bindTo, was this:

use a variable prefixed with _, which will not be saved to the server, but will trigger $watch().

However when I used $scope.actions[key]._loading instead, the same problem still occurred. There was no apparent difference.

I am having same issue. but this seems to fix it. https://www.firebase.com/docs/web/libraries/angular/api.html#angularfire-firebaseobject-bindtoscope-varname

If $destroy() is emitted by scope (this happens when a controller is > destroyed), then this object is automatically unbound from scope. It can > also be manually unbound using the unbind() method, which is passed into ? > the promise callback.

//Setup synced array as usual

$scope.syncedArray = $firebaseArray(ref);

//call unbind on the variable

$scope.syncedArray.unbind();

//reorder, filter and maniuplate arrays as usual and when done call .bind() on it.

I couldn't find a clean solution to the problem.

use a variable prefixed with _, which will not be saved to the server, but will trigger $watch().

This wasn't actually implemented in code. I was considering submitting an implementation myself but it wasn't as simple as I hoped. Even after toJSON stopped returning _'d variables, it still tried to save the (unchanged) JSON to Firebase, so you'd have to fix it earlier somehow... I didn't go there.

To solve the problem I used AngularFire's $asArray instead of $asObject. The array is READ ONLY. Firebase won't try to sync any changes unless you call special functions. In my case, this works, however in other cases it might not be sufficient.

I had to change a bit my templating to work with an array instead of an object since a numerical key was now being provided instead of the actual key being used in Firebase. I converted the numerical key to the proper one with: actions.$keyAt(parseInt(key)).

It was a mess.. but it'll get me through for now.