Skip to content

Commit

Permalink
Merge branch 'develop' into lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
gliechtenstein authored Feb 14, 2017
2 parents 1ce810c + 5b961d4 commit de36ba2
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions app/Jasonette/Jason.m
Original file line number Diff line number Diff line change
Expand Up @@ -725,10 +725,38 @@ - (void)render{
* }
* }
*
* In this case, we override whatever data gets passed in from the register with the data object that's manually passed in.
* 1. In this case we override the $jason value with the value inside `data`.
*
**************************************************/
data_stub[@"$jason"] = [self filloutTemplate:stack[@"options"][@"data"] withData:data_stub];
* In above example, The $jason value at the point of rendering becomes:
*
* $jason = {
* "results": [{
* "id": "1",
* "name": "tom"
* }, {
* "id": "2",
* "name": "kat"
* }]
* }
*
* 2. The `data` can also be a template expression, in which case it will parse whatever data is being passed in to `$render` before using it as the data.
*
* {
* "type": "$render",
* "options": {
* "data": {
* "results": {
* "{{#each $jason}}": {
* "id": "{{id}}",
* "name": "{{name}}"
* }
* }
* }
* }
* }
*
**************************************************/
data_stub[@"$jason"] = [self filloutTemplate:stack[@"options"][@"data"] withData:data_stub];
}
}
}
Expand Down

0 comments on commit de36ba2

Please sign in to comment.