EMBER WORKSHOP: RSVP.hash simple
Views w/ RSVP.hash
HTML
<script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0/handlebars.js"></script>
<script src="http://builds.emberjs.com/tags/v1.9.0/ember.js"></script>
<script type="text/x-handlebars">
{{outlet}}
</script>
<script type="text/x-handlebars" data-template-name="index">
<div class="wrapper">
<p>{{currentTime}}</p>
<p>{{categoryName}}</p>
</div>
</script>
SCSS
body {
font-family: Optima, serif;
}
code {
color: gainsboro;
background-color: ghostwhite;
}
.wrapper {
overflow: hidden;
padding: 10px;
}
.column {
box-sizing: border-box;
float: left;
width: 50%;
padding: 10px;
border-right: 1px solid #ccc;
&:last-child {
border-right: none;
}
}
JavaScript
var App = Ember.Application.create({
});
App.IndexRoute = Ember.Route.extend({
model: function() {
let deferred = Ember.RSVP.defer();
return Ember.RSVP.hash(function () {
throw new Error();
}).then(function(response){
throw new Error();
},function(eee){
console.log(e);
}).catch(function (eee) {
return {currentTime:"dfgdf", categoryName:"dsfsdf"};
console.log("Error called from catch");
})
}
});