javascript - Editing a delimited string using multiple input fields in AngularJS -


i trying following quite unsuccessfully far.

i have string semicolon separated. list of emails,

'email1@example.com;email2@example.com;email3@example.com' 

what trying accomplish split string (using split(';')) array of strings or array of objects (to aid binding). each of items bind different input elements. after editing want read concatenated value again send backend.

problem when editing 1 of split inputs, original item value not update (which makes sense guessing individual items copies of parts of original), wondering if there way that. note want go both ways, watching individual inputs , updating original 1 manually, fire infinite loop of updates.

i have tried few different ways, including creating items property get/set using object.defineproperty read , right string (set never fired).

take @ plnker

you can construct temporary array on each field update in order string replacement of old segment new value. in order tackle lost focus problem have use ngreapeat's track $index. internal array not recreated unless add separator original string.

here complete solution on plunker


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -