Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
<!-- This is the main html file for the guess a number game

     It sets up a div as an attachment point for the view

     Includes some helper CSS, and loads the necessary

     javascript files

-->

<!doctype html>

<html>

<head>

    <title>Guess a number</title>

    <meta charset="utf-8">

    <link rel="stylesheet" href="css/bootstrap.min.css">

    <link rel="stylesheet" href="css/contacts.css">

</head>

<body>

<div id="guessView" ></div>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"></script>

<script src="js/can.jquery.js"></script>

<script src="js/can.fixture.js"></script>

<script src="js/guess.js"></script>

</body></html>

...

guessView.ejs

<!-- This file is a very simple view that consists of a label and a text field
     The label comes dynamically from the message field of the observable myData
  -->
<form name='myform' >
<div >
<!-- This next line inserts the value of the message field on the myData observable.
     Using attr  to ftech it makes it "magic" in that the HTML wll update automatically
     when the obervable is aware of a change to the value of the message field. -->
<%= myData.attr('message'); %>
<input id='guess' type="text" name="guess" >
</div>
</form >

Code Block
 <!-- This file is a very simple view that consists of a label and a text field
     The label comes dynamically from the message field of the observable myData
  -->
<form name='myform' >
<div >
<!-- This next line inserts the value of the message field on the myData observable.
     Using attr  to ftech it makes it "magic" in that the HTML wll update automatically
     when the obervable is aware of a change to the value of the message field. -->
<%= myData.attr('message'); %>
<input id='guess' type="text" name="guess" >
</div>
</form >
&nbsp;

...