Skip to content

Instantly share code, notes, and snippets.

@typeoneerror
Last active February 17, 2016 18:19
Show Gist options
  • Save typeoneerror/7dd97911d1226d1b6b10 to your computer and use it in GitHub Desktop.
Save typeoneerror/7dd97911d1226d1b6b10 to your computer and use it in GitHub Desktop.
<head>
<style id="course-styles"></style>
</head>
afterModel(model, transition) {
const service = this.get('styleCache');
const course = model.course;
const key = `course-${course.get('id')}`;
if (service.has_key(key)) {
course.set('_styleCache', service.fetch(key));
return RSVP.resolve();
}
else {
return jQuery.get(course.get('stylesheetUrl')).then((css) => {
service.store(key, css);
course.set('_styleCache', css);
});
}
}
{{#ember-wormhole to="course-styles"}}
{{course._styleCache}}
{{/ember-wormhole}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment