user2881430
user2881430

Reputation: 367

split string using ng-list inside ng-repeat

I'm trying to split data inside ng-repeat using ng-list which is not working

tr(ng-repeat='row in displayedCollection', style='padding:5px')
   td {{row.ID}}
   td 
     span(data-ng-hide="editMode") {{row.SOME[0]}}
     select.form-control.trkatn(name="SOME", data-ng-model="row.SOME", data-ng-show="editMode", ng-list=":", ng-trim="false")

here data in displayedCollection is coming from database using ajax and the values are somewhat like below example

[{ ID: '023YHZ', SOME: 'Value12 1448883027057'},
 {ID: '023NHZ', SOME: 'Value32 1448883027057'},
 {ID: '023YJZ', SOME: 'Value23 1448883027057'}]

now I want to extract value12 from some and other.

i tried doing it however it is showing 1st character of SOME if I use row.SOME[0] and full SOME value if I use row.SOME i.e Value12 1448883027057 for an example

Upvotes: 0

Views: 273

Answers (1)

user2033671
user2033671

Reputation:

You will have to split the string first

row.SOME.split(' ') 
>['Value12','1448883027057']
row.SOME.split(' ')[0]
>'Value12'
row.SOME.split(' ')[1]
>'1448883027057'

Upvotes: 1

Related Questions