Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="CanJS nested observed list" />
  
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
  
  <script src="http://canjs.us/release/latest/can.jquery.js"></script>
  
<meta charset=utf-8 />
  
<title>JS Bin</title>
</head>
  
<body>
  <div id="app">    </div>
  
  <script type='text/ejs' id='template'>
    <% list(items, function(item){ %>
      <div>
            <%= item.attr('name') %>
            <% list(item.comments, function(comment){ %>
                <li><%= comment %></li>
            <% }) %>
        </div>
    <% }) %>
  </script>
  
</body>
</html>
 
console.log(can)
var Control = can.Control({
  init: function (ele, ops){
    var items = new can.Observe.List([{name:'1', comments: ['great']}, {name:'2'}]);
    ele.append( can.view("template", {items: items}) )
  }
})
var control = new Control('#app');
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
sportopro
0viewers