Skip to content

Instantly share code, notes, and snippets.

@darthdeus
Created May 12, 2013 16:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darthdeus/5564019 to your computer and use it in GitHub Desktop.
Save darthdeus/5564019 to your computer and use it in GitHub Desktop.
App.ImageView = Ember.View.extend({
tagName: "img",
attributeBindings: ["src"],
failed: false,
didInsertElement: function() {
var self = this;
this.$()[0].onerror = function() {
if (!self.get("failed") && self.get("state") !== "destroyed") {
self.set("failed", true);
this.src = "https://s3.amazonaws.com/foobar/default_image.png";
}
};
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment