Ember.js Starter Kit
Based on latest version of Ember.js with the new router.
HTML
<script src="https://github.com/downloads/wycats/handlebars.js/handlebars-1.0.rc.1.js"></script>
<script src="https://gist.github.com/raw/4427466/a36a4f88a1a19f0b4ee38948af3bcdfa6c651d40/ember-latest.js"></script>
<script type="text/x-handlebars" data-template-name="application">
{{view App.UserLinksView contentBinding="App.status.text"}}
</script>
JavaScript
App = Ember.Application.create();
App.ApplicationController = Ember.Controller.extend();
App.ApplicationView = Ember.View.extend({
templateName: 'application'
});
App.status = Ember.Object.create({
text: "some initial text for @demo purposes"
});
Ember.run.later(function() {
App.status.set("text", "new text @user");
}, 1000);
App.Router = Ember.Router.extend();
App.UserLinksView = Ember.View.extend({
template: function() {
var template = this.get("content");
if (template) {
template = template.replace(/@(\w+)/, '<a href="#/users/$1">@$1</a>');
}
return Ember.Handlebars.compile(template);
}.property("content"),
contentChanged: function() {
this.rerender();
}.observes("content")
});
App.Router.map(function(match) {
match("/").to("home");
});