Last active
December 10, 2015 07:50
-
-
Save siva-sundar/18bc4c7e08656a86d73a to your computer and use it in GitHub Desktop.
stack ovflw
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName:'Ember Twiddle', | |
date: new Date(), | |
current_date: function() { | |
var d = this.get('date'); | |
var date = '01'; | |
var month = d.getMonth() + 1; | |
var year = d.getFullYear(); | |
return { | |
date: date, | |
month: month, | |
year: year | |
}; | |
}.property('date'), | |
actions: { | |
previousMonth: function() { | |
var date = this.get('date'); | |
date.setMonth(date.getMonth() - 1); | |
this.set('date', date); | |
console.log(this.get('date')); | |
}, | |
nextMonth: function() { | |
var date = this.get('date'); | |
date.setMonth(date.getMonth() + 1); | |
this.set('date', date); | |
console.log(this.get('date')); | |
} | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default Ember.View.extend({ | |
templateName: 'my-route', | |
date: function() { | |
var raw_date = this.get('controller.current_date'); | |
return raw_date.month + " " + raw_date.year; | |
}.property('controller.current_date') | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.4.17", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "1.12.1", | |
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.2.0/ember-data.js", | |
"ember-template-compiler": "1.12.1" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default Ember.View.extend({ | |
templateName: 'my-route', | |
date: function() { | |
var raw_date = this.get('controller.current_date'); | |
return raw_date.month + " " + raw_date.year; | |
}.property('controller.current_date') | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment