Created
October 7, 2013 22:19
-
-
Save eloone/6875969 to your computer and use it in GitHub Desktop.
Print key value pairs in Handlebars
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
data = { | |
ctrl_path: | |
{ message: 'Validator "required" failed for path ctrl_path with value ``', | |
name: 'ValidatorError', | |
path: 'ctrl_path', | |
type: 'required', | |
value: '' }, | |
ctrl_name: | |
{ message: 'Validator "required" failed for path ctrl_name with value ``', | |
name: 'ValidatorError', | |
path: 'ctrl_name', | |
type: 'required', | |
value: '' }, | |
url_schema: | |
{ message: 'Validator "required" failed for path url_schema with value ``', | |
name: 'ValidatorError', | |
path: 'url_schema', | |
type: 'required', | |
value: '' } | |
} | |
*/ | |
//reserved keywords @key and this | |
{{#each data}} | |
<p class="alert-error">{{@key}} : {{this.message}}</p> | |
{{/each}} | |
/* | |
output : | |
<p class="alert-error">ctrl_path : Validator "required" failed for path ctrl_path with value ``</p> | |
<p class="alert-error">ctrl_name : Validator "required" failed for path ctrl_name with value ``</p> | |
<p class="alert-error">url_schema : Validator "required" failed for path url_schema with value ``</p> | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment