Meteor template Blaze how to return only first element of array
Asked Answered
F

1

15

For example I have an array: var arr = ['a', 'b'] and want to get only first element in template

Faller answered 20/2, 2015 at 13:38 Comment(0)
L
28

Use {{arr.[0]}}.

See Blaze docs.

Legendre answered 20/2, 2015 at 14:32 Comment(1)
@BoumTAC, Clarification: You need to have a helper (or a field in the data context) named arr that returns the array.Legendre

© 2022 - 2024 — McMap. All rights reserved.