Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Referring to individual array element #16

Open
microdee opened this issue Dec 12, 2018 · 3 comments
Open

Referring to individual array element #16

microdee opened this issue Dec 12, 2018 · 3 comments

Comments

@microdee
Copy link

I have given model

{
   "array": [ "foo", "bar", "fizz", "buzz"]
}

in mustache.js you can access individual array elements with this syntax: {{array.2}} which should return "fizz". I tried it with Mustachio and unfortunately it doesn't work. It just interpolates to nothing, no exceptions thrown.
Is there a working way of doing this in Mustachio? If not is there an argument against it?

@JPVenson
Copy link

JPVenson commented Dec 23, 2018

Hey @microdee.
mustachio array accessors are not Impediment yet. See https://github.com/wildbit/mustachio/blob/7e0c16c8d35133e3ba837d88af349be76decd0b2/Mustachio/ContextObject.cs#L38

Mustachio have not gotten any feature update since a few years, but i have forked it and made a few changes to it you might want to check it out:
https://github.com/JPVenson/morestachio

@microdee
Copy link
Author

hey thanks for the tip! I'll check out morestachio later, maybe implement the array accessor if I get bored

@JPVenson
Copy link

i hope so :-D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants