Icontem

File: tests/9.html

Recommend this page to a friend!
  Classes of Aliaksandr Astashenkau  >  Templ  >  tests/9.html  >  Download  
File: tests/9.html
Role: Example script
Content type: text/plain
Description: Ternary operator
Class: Templ
Processes templates embedded in the pages
Author: By
Last change:
Date: 8 years ago
Size: 808 bytes
 

Contents

Class file image Download
<!DOCTYPE HTML>
<html lang="en">
<head>
	<title>Templ test</title>
	<meta charset="UTF-8">
	<link rel="stylesheet" href="style.css">
	<script type="text/javascript" src="utils.js"></script>
	<script type="text/javascript" src="../templ.js"></script>
</head>
<body>

<h2>
	Ternary operator
	<a href="index.html" class="back">Back to tests</a>
</h2>

<script type="html/template" id="tpl_example">
    {{ true ? 'True' : 'False' }}
    {{ Math.floor(new Date().getTime() / 1000) > created_at ? '1' : '2' }}
    <input type="checkbox" {{ parseInt(profileActive) ? 'checked' : '' }}>
</script>

<h3>Template</h3>
<pre id="template"></pre>

<h3>Data</h3>
<pre id="data">
    {
        created_at: 1200213564,
        profileActive: "1"
    }
</pre>

<h3>Parsed result</h3>
<pre id="output"></pre>

</body>
</html>