How do I alter app data in offline mode and sync to server without an ID?

I'm creating an iPhone app using Ionic. Let's say we have a list of posts displayed in the app. Now, for a typical POST operation, a new object is created and unshifted to an array of posts without a unique ID. After the server sync happens, during the .success() callback, a unique ID is returned from the API, which is later assigned to the new object at index 0 of my posts array.

I'm currently working on an "offline mode" for my app, which should work when the user doesn't have an internet connection. I'm doing well: the data is stored in localStorage while the user is offline. When navigator.onLine becomes true, it is synced with the server.

The problem though is this: if the post is edited BEFORE the sync happens and BEFORE the unique ID is returned, the edits are not saved because there is no ID attribute attached to the new object, which is typically sent to the server for a PUT or POST request.

I'd like to be able to save changes to this new object while people are still offline. Is this possible? Is there something I'm missing? If so, how do I implement this?