Skip to content

Instantly share code, notes, and snippets.

@jayphelps
Created January 15, 2014 06:38
Show Gist options
  • Save jayphelps/8431829 to your computer and use it in GitHub Desktop.
Save jayphelps/8431829 to your computer and use it in GitHub Desktop.
Demo from my Ember.String.interpolate talk @ the Ember.js Southern California Meetup. Library: https://github.com/jayphelps/ember.string.interpolate Slides: https://www.slideshare.net/jayphelps/emberstringinterpolate
this.App = Ember.Application.create();
App.IndexController = Ember.ObjectController.extend({
firstName: null,
lastName: null,
fullName: '$firstName $lastName'.interpolate().readOnly()
});
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<script type="text/x-handlebars" id="index">
<h1>Enter your name:</h1>
<p>First: {{input placeholder="e.g. John" value=controller.firstName}}</p>
<p>Last: {{input placeholder="e.g. Doe" value=controller.lastName}}</p>
<hr>
<div>Your full name is: {{fullName}}</div>
</script>
<script src="js/libs/jquery-1.10.2.js"></script>
<script src="js/libs/handlebars-1.1.2.js"></script>
<script src="js/libs/ember-1.3.1.js"></script>
<script src="js/libs/ember-string-interpolate.js"></script>
<script src="js/app.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment