I have a mysql column contain Array in it. And when printing this row that contain column in console.log(collection[0]) The result is:
RowDataPacket {
id: 6,
title: 'fsd',
createddate: '2016-04-14 00:16:29',
tag: 'fsdsd',
img1: '[\'12071331_184535658548108_1612982316_n.jpg\', \'12071715_826061364175214_103377995_n.jpg\', \'12076929_10207206326744146_1386812779_n.jpg\']',
img1big: '[\'small_12071331_184535658548108_1612982316_n.jpg\', \'small_12071715_826061364175214_103377995_n.jpg\', \'small_12076929_10207206326744146_1386812779_n.jpg\']' }
and i want to print the value 12071331_184535658548108_1612982316_n.jpg to view. I used a method like this:
{% for i in collection %}
{{i.img1[0]}}
{% endfor %}
But the view showed only first character of a string:
[
The result of {{i.img1}} is :
['12071331_184535658548108_1612982316_n.jpg', '12071715_826061364175214_103377995_n.jpg', '12076929_10207206326744146_1386812779_n.jpg']
The question is, how can i print 12071331_184535658548108_1612982316_n.jpg on the view?
P/s: I tried to use both JSON.parse() and JSON.stringify() for some cases in both controller and view, but no uses.
Thanks