Hello,

My application is a task-scheduler operated by commands entered into a text 
input box.

I have a synced array obtained by using AngularFire's $asArray() method. 
I'd like to add "indices" or "handles" to the tasks so that they are 
numbered 1,2,3 etc... (so the user can type "del 2" to delete task 2 for 
example). The handles must only exist in the current view/user session, not 
be persisted. I want to keep the numbers short to type. It doesn't matter 
if the handles change from one session or page refresh to the next (using 
ngRoute so it's single-page app) and it doesn't matter if they end up non 
continuous or non-sequential at times.

I am not wanting to use the index position in the array, as I that is 
unreliable in an asynchronous environment where the underlying array can be 
changed at source. 

So far my solutions are:

a) append a "handle" property to each item in the array that I can set on 
initial loading. But then the handle will be persisted to the database 
whenever I save, which I don't want.
b) build a register of what handles correspond to which instances in the 
array. It would have to be a  two-way thing as I want to determine the 
handle from the instance to display it, and get the instance from the 
handle when it comes to saving it.

I am not sure if the solution relates more to javascript, angular, 
angularfire or firebase. Pretty new to it all.
I'm tempted to just go with option "b", but I thought I'd ask on here first 
in case there was an existing solution to that, and I'm also curious how 
one would go about option "a" (i.e. appending properties that aren't 
persisted by angular) assuming that's what I wanted to do for whatever 
reason.
Or any idea/suggestions?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to