Skip to content

Instantly share code, notes, and snippets.

@givanse
Created November 18, 2014 16:02
Show Gist options
  • Save givanse/114ece0456c2e8f4a742 to your computer and use it in GitHub Desktop.
Save givanse/114ece0456c2e8f4a742 to your computer and use it in GitHub Desktop.
Ember Starter Kit img src is a bind // source http://emberjs.jsbin.com/dukiyavote
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="img src is a bind" />
<meta charset="utf-8">
<title>Ember Starter Kit</title>
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/normalize/2.1.0/normalize.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v1.3.0.js"></script>
<script src="http://builds.emberjs.com/tags/v1.8.0/ember.js"></script>
<style id="jsbin-css">
/* Put your CSS here */
html, body {
margin: 20px;
}
.img {
border: 1px solid #000;
min-width: 350px;
min-height: 150px;
}
</style>
</head>
<body>
<script type="text/x-handlebars">
<h2>Welcome to Ember.js</h2>
{{outlet}}
</script>
<script type="text/x-handlebars" data-template-name="index">
img src =
{{input value=imgSrcValue}}<br>
<br>
property: {{imgSrcValue}}<br>
<br>
src unbound: <br>
<div class="img">
<img src="{{unbound imgSrcValue}}">
</div>
<br>
<br>
src bound: <br>
<div class="img">
<img {{bind-attr src="imgSrcValue"}}>
</div>
</script>
<script id="jsbin-javascript">
App = Ember.Application.create();
App.Router.map(function() {
// put your routes here
});
App.IndexRoute = Ember.Route.extend({});
App.IndexController = Ember.Controller.extend({
imgSrcValue: "http://placehold.it/350x150"
});
</script>
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html>
<html>
<head>
<meta name="description" content="img src is a bind" />
<meta charset="utf-8">
<title>Ember Starter Kit</title>
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/normalize/2.1.0/normalize.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"><\/script>
<script src="http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v1.3.0.js"><\/script>
<script src="http://builds.emberjs.com/tags/v1.8.0/ember.js"><\/script>
</head>
<body>
<script type="text/x-handlebars">
<h2>Welcome to Ember.js</h2>
{{outlet}}
<\/script>
<script type="text/x-handlebars" data-template-name="index">
img src =
{{input value=imgSrcValue}}<br>
<br>
property: {{imgSrcValue}}<br>
<br>
src unbound: <br>
<div class="img">
<img src="{{unbound imgSrcValue}}">
</div>
<br>
<br>
src bound: <br>
<div class="img">
<img {{bind-attr src="imgSrcValue"}}>
</div>
<\/script>
</body>
</html>
</script>
<script id="jsbin-source-css" type="text/css">/* Put your CSS here */
html, body {
margin: 20px;
}
.img {
border: 1px solid #000;
min-width: 350px;
min-height: 150px;
}</script>
<script id="jsbin-source-javascript" type="text/javascript">App = Ember.Application.create();
App.Router.map(function() {
// put your routes here
});
App.IndexRoute = Ember.Route.extend({});
App.IndexController = Ember.Controller.extend({
imgSrcValue: "http://placehold.it/350x150"
});</script></body>
</html>
/* Put your CSS here */
html, body {
margin: 20px;
}
.img {
border: 1px solid #000;
min-width: 350px;
min-height: 150px;
}
App = Ember.Application.create();
App.Router.map(function() {
// put your routes here
});
App.IndexRoute = Ember.Route.extend({});
App.IndexController = Ember.Controller.extend({
imgSrcValue: "http://placehold.it/350x150"
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment