Meteor started
For Developer Ruby On Rails i think we must learn meteor, why? I have interest article on here (Meteor Kill in Rails), just as a precaution if it could possibly :D
Oke now We must install meteor :
A. For OS X or Linux
curl https://install.meteor.com/ | shB. For Windows
https://install.meteor.com/windowsCreating first app
In this Totorial we will create a simple app to manage a todo list
meteor create simple-todosThis will create a new folder called `simple-todos` with all of the files a Meteor app needs:
simple-todos.js # a JavaScript file loaded on both client and server simple-todos.html # an HTML file that defines view templates simple-todos.css # a CSS file to define your app’s styles
.meteor # internal Meteor filesDon’t forget run meteor on terminal and go to http://localhost:3000
Get Zainal Mustofa’s stories in your inbox
Join Medium for free to get updates from this writer.
Replace on simple-todos.html
<head><title>Todo List</title></head><body><div class="container"><header><h1>Todo List</h1></header><ul>{{#each tasks}}{{> task}}{{/each}}</ul></div></body><template name="task"><li>{{text}}</li></template>
Replace on simple-todos.js
if (Meteor.isClient) {// This code only runs on the clientTemplate.body.helpers({tasks: [{ text: "This is task one" },{ text: "This is task two" },{ text: "This is task three" }]});}
Open a browser and go to http://localhost:3000 the view will be look like this :
conclusion
Meteor parses all of the HTML files in your app folder and identifies three top-level tags: <head>, <body>, and <template>.
Everything inside any <head> tags is added to the head section of the HTML sent to the client.
And everything inside <body> tags is added to the body section, just like in a regular HTML file.
If you see on <ul> tags meteor use spacebars compiler. Spacebars uses statements surrounded by double curly braces such as {{#each}} and {{#if}} to let you add logic and data to your views. You can pass data into templates from your JavaScript code by defining helpers. In the code above, we defined a helper called tasks on Template.body that returns an array. Inside the body tag of the HTML, we can use {{#each tasks}} to iterate over the array and insert a task template for each value. Inside the #each block, we can display the text property of each array item using {{text}}.
Everything inside <template> tags is compiled into Meteor templates, which can be included inside HTML with {{> templateName}} or referenced in your JavaScript with Template.templateName .
You can following tutorial on here








