Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Ember from 'ember';
- export default Ember.Controller.extend({
- appName:'Ember Twiddle',
- name: "",
- balance: 0,
- totalBalanceInCents: function() {
- var totalBalance = 0.0;
- this.model.forEach(function(account, index) {
- totalBalance += account.get('balance_in_cents');
- });
- return totalBalance;
- }.property('model.@each.balance_in_cents'),
- totalBalance: function() {
- return this.get('totalBalanceInCents') / 100;
- }.property('totalBalanceInCents'),
- actions: {
- createAccount() {
- Ember.debug("createAction triggered");
- this.store.createRecord('account', {
- name: this.get('name'),
- balance: this.get('balance')
- });
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement