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

with helper not working when this refers to a struct #35

Open
nektro opened this issue Apr 7, 2020 · 0 comments
Open

with helper not working when this refers to a struct #35

nektro opened this issue Apr 7, 2020 · 0 comments

Comments

@nektro
Copy link

nektro commented Apr 7, 2020

html:

{{#with (lookup mymap 'key')}}
<p>0: {{this}}</p>
<p>1: {{ID}}</p>
<p>2: {{this.ID}}</p>
{{/with}}

context:

type MyStruct struct {
	ID string `json:"id"`
}
ctx := map[string]interface{}{
	"mymap": map[string]MyStruct{
		"key": MyStruct{
			ID: "42",
		},
	},
}

expected result:

<p>0: {42}</p>
<p>1: 42</p>
<p>2: 42</p>

actual result:

<p>0: {42}</p>
<p>1: </p>
<p>2: </p>
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

1 participant