RIOT.JS Tutorial
Selected Reading
- RIOT.JS - Discussion
- RIOT.JS - Useful Resources
- RIOT.JS - Quick Guide
- RIOT.JS - Observables
- RIOT.JS - Mixin
- RIOT.JS - Loops
- RIOT.JS - Accessing DOM
- RIOT.JS - Event Handling
- RIOT.JS - Yield
- RIOT.JS - Conditional
- RIOT.JS - Styling
- RIOT.JS - Expressions
- RIOT.JS - Tags
- RIOT.JS - First Application
- RIOT.JS - Environment Setup
- RIOT.JS - Overview
- RIOT.JS - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
RIOT.JS - Yield
RIOT.JS - Yield
Yield is a mechanism to put external html content into a RIOT tag. There are multiple ways to do an yield.
Simple Yield − If we want to replace a single placeholder in tag. Then use this mechanism.
<custom3Tag> Hello <yield/> </custom3Tag>
<custom3Tag><b>User</b></custom3Tag>
Multiple Yield − If we want to replace multiple placeholders in tag. Then use this mechanism.
<custom4Tag> <br/><br/> Hello <yield from = "first"/> <br/><br/> Hello <yield from = "second"/> </custom4Tag>
<custom4Tag> <yield to = "first">User 1</yield> <yield to = "second">User 2</yield> </custom4Tag>
Example
Following is the complete example.
custom3Tag.tag
<custom3Tag> Hello <yield/> </custom3Tag>
custom4Tag.tag
<custom4Tag> <br/><br/> Hello <yield from = "first"/> <br/><br/> Hello <yield from = "second"/> </custom4Tag>
custom3.htm
<html> <head> <script src = "https://cdnjs.cloudflare.com/ajax/pbs/riot/3.13.2/riot+compiler.min.js"></script> </head> <body> <custom3Tag><b>User</b></custom3Tag> <custom4Tag> <yield to = "first">User 1</yield> <yield to = "second">User 2</yield> </custom4Tag> <script src = "custom3Tag.tag" type = "riot/tag"></script> <script src = "custom4Tag.tag" type = "riot/tag"></script> <script> riot.mount("custom3Tag"); riot.mount("custom4Tag"); </script> </body> </html>
This will produce following result −
Advertisements