-
Notifications
You must be signed in to change notification settings - Fork 4
Home
Adam Grant edited this page Sep 27, 2016
·
7 revisions
[Create ajax routing for a component](ajax routing)
<div data-component="number_collector">
<input type="tel" />
<button id="send">Send</button>
</div>
m$.number_collector.events = function(_$) {
_$("#send").click(function() {
_$.api.create({ number: _$("input").val(); });
});
}
Pass backend variables to components
m$.store = {
my_component: { users: @users }
}
m$.my_component.ready(function(_$) {
_$.store.users.forEach(function(user) {
// ...
});
});