ripplejs / ripple

A tiny foundation for building reactive views
http://ripplejs.github.io
1.28k stars 66 forks source link

Cannot get the sample composed view to work #14

Closed lmartins closed 10 years ago

lmartins commented 10 years ago

Hi, im now following the docs to learn the essentials of Ripple but im stuck on the following code.

events      = require "events"
each        = require "each"
dispatch    = require "dispatch"
ripple      = require 'ripple'

Avatar = ripple 'Avatar: {{username}}'
Link = ripple 'Link: {{username}}'

Profile = ripple('#profileTemplate')
  .compose 'profile-avatar', Avatar
  .compose 'profile-link', Link

profile = new Profile
  data:
    username: 'lmartins'

profile.appendTo document.body

Im referencing a template that I have on my document, like this:

<script type="text/template" charset="utf-8" id="profileTemplate">
      <div class="Profile">
        <profile-avatar username="{{username}}"></profile-avatar>
        <profile-link username="{{username}}"></profile-link>
      </div>
    </script>

In runtime this outputs:

<div class="Profile">
        Avatar: lmartins
        <profile-link username="{{username}}"></profile-link>
      </div>

Any ideia why the second custom-element isn't being outputting anything?

anthonyshort commented 10 years ago

Bump to 0.3.3, that bug was fixed :)

anthonyshort commented 10 years ago

You can do multi-line strings in CS too, which should make it super easy to just do inline templates in your components if that's your thing

lmartins commented 10 years ago

Nice, updated and solved. Tks Anthony. Thanks for tip on multiline string from CS. I knew about them but didn't occur to me. Will become handy if I end up using a build system other than Component.