javascript - Meteor template not working/blank page -
i using cloud9 , meteor package.
i have been given instructions create keypad template , implement it. have followed of instructions page goes blank when call template {{> mykeypad}}
if {{mykeypad}}
page not go blank template not appear.
this code:
<body> <h1>week 2</h1> <ul class="nav navbar-nav"> <li><a class="navbar-brand">asdadsada</a></li> <li><a>test1</a></li> <li><a>test2</a></li> <li><a>test3</a></li> </ul> <br /> <br /> <br /> <button class="btn btn-default" type="submit">button <span class="glyphicon glyphicon glyphicon-ok"></span> </button> <div class="container"> <div class="row"> <div id="left-box" class="col-md-4"> adadasdasd </div> <div id="right-box" class="col-md-8"> asdasdad {{mykepad}} </div> </div> </div> <template name="mykeypad"> <button class="btn {{button1class}}">1</button> <button class="btn {{button2class}}">2</button> <button class="btn {{button3class}}">3</button> <button class="btn {{button4class}}">4</button> <button class="btn {{button5class}}">5</button> <button class="btn {{button6class}}">6</button> <button class="btn {{button7class}}">7</button> <button class="btn {{button8class}}">8</button> <button class="btn {{button9class}}">9</button> </template> </body>
and in meteor.js
if (meteor.isclient) { // counter starts @ 0 session.setdefault('counter', 0); template.hello.helpers({ counter: function () { return session.get('counter'); } }); template.hello.events({ 'click button': function () { // increment counter when button clicked session.set('counter', session.get('counter') + 1); } }); session.set("button1class", "btn-default"); session.set("button2class", "btn-default"); session.set("button3class", "btn-default"); session.set("button4class", "btn-default"); session.set("button5class", "btn-default"); session.set("button6class", "btn-default"); session.set("button7class", "btn-default"); session.set("button8class", "btn-default"); session.set("button9class", "btn-default"); template.mykeypad.helpers( { "button1class" : function () { return session.get("button1class")}, "button2class" : function () { return session.get("button2class")}, "button3class" : function () { return session.get("button3class")}, "button4class" : function () { return session.get("button4class")}, "button5class" : function () { return session.get("button5class")}, "button6class" : function () { return session.get("button6class")}, "button7class" : function () { return session.get("button7class")}, "button8class" : function () { return session.get("button8class")}, "button9class" : function () { return session.get("button9class")}, }); }
i have no idea why template not showing/breaking site , making blank.
<body>
is considered template. therefore defining template inside template's definition. not permitted!
<template name="something"> <template name="someotherthing"> {{!-- incorrect --}} </template> </template>
what want define mykeypad
template outside of <body>
:
<body> <h1>week 2</h1> <!-- ... --> {{> mykepad}} <!-- ... --> </body> <template name="mykeypad"> <button class="btn {{button1class}}">1</button> <button class="btn {{button2class}}">2</button> <button class="btn {{button3class}}">3</button> <button class="btn {{button4class}}">4</button> <button class="btn {{button5class}}">5</button> <button class="btn {{button6class}}">6</button> <button class="btn {{button7class}}">7</button> <button class="btn {{button8class}}">8</button> <button class="btn {{button9class}}">9</button> </template>
Comments
Post a Comment