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

Allow for looping array of string #72

Closed
wants to merge 2 commits into from

Conversation

ssured
Copy link
Contributor

@ssured ssured commented Aug 30, 2014

content: {selection:['yellow','green','blue']}
template: {#selection}{value} {/selection}
result: yellow green blue

content: `{selection:['yellow','green','blue']}'
template: `{#selection}{value}{/selection}`
@edi9999
Copy link
Member

edi9999 commented Aug 30, 2014

Hi,

I like the idea.

As many times, I prefer to use the mustache way, eg {.} Means the current this. Without modifying the scope on runtime

@ssured
Copy link
Contributor Author

ssured commented Aug 30, 2014

Hey, nice. I did not know the mustache way…

Testing fails for me though. {#loop}{.}{/loop} gives NaN NaN Weird, I’ll look into it

On 30 Aug 2014, at 22:44, edi9999 notifications@github.com wrote:

Hi,

I like the idea.

As many times, I prefer to use the mustache way, eg {.} Means the current this. Without modifying the scope on runtime


Reply to this email directly or view it on GitHub.

@edi9999
Copy link
Member

edi9999 commented Aug 30, 2014

Yes it's not yet implemented in the library, it was just as an idea. But it's probably a one liner.

@edi9999
Copy link
Member

edi9999 commented Aug 30, 2014

It should be in the DocUtils.defaultparser

@ssured
Copy link
Contributor Author

ssured commented Aug 30, 2014

My fix is not working though, I was just testing... I'll look into defaultparser

@edi9999
Copy link
Member

edi9999 commented Aug 31, 2014

Updated as of v0.7.3, on npm too

@ssured
Copy link
Contributor Author

ssured commented Aug 31, 2014

Awesome!

@ssured
Copy link
Contributor Author

ssured commented Aug 31, 2014

I was testing this, but the solution does not work with angular parser enabled. Any way to do this?

@ssured
Copy link
Contributor Author

ssured commented Aug 31, 2014

I now use this code to have to detect {.} tags, which works

expressions = require 'angular-expressions'
angularParser = (tag) ->
  return {get: (s) -> s} if tag == '.'
  get: expressions.compile tag

@ssured ssured deleted the patch-1 branch August 31, 2014 11:57
@edi9999
Copy link
Member

edi9999 commented Aug 31, 2014

Yes that should do the trick.

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

Successfully merging this pull request may close these issues.

None yet

2 participants