mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Fixes #98 - docs for <include template-data="...">
This commit is contained in:
parent
6bc4a0f4b0
commit
9f4085e5b9
@ -692,9 +692,15 @@ Marko supports includes/partials. Other Marko files can be included using the `<
|
|||||||
<include template="./greeting.marko" name="Frank" count="30"/>
|
<include template="./greeting.marko" name="Frank" count="30"/>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Alternatively, you can pass the template data using the `template-data` attribute whose value should be a JavaScript expression that resolves to the template data as shown below:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<include template="./greeting.marko" template-data="{ name: 'Frank', count: 30 }"/>
|
||||||
|
```
|
||||||
|
|
||||||
The value of the `template` attribute can also be a dynamic JavaScript expression that resolves to a loaded template as shown below:
|
The value of the `template` attribute can also be a dynamic JavaScript expression that resolves to a loaded template as shown below:
|
||||||
|
|
||||||
In your controller:
|
In your JavaScript controller:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var myIncludeTarget = require('./my-include-target.marko');
|
var myIncludeTarget = require('./my-include-target.marko');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user