Hello everyone, I am excited to be posting on stackoverflow for the first time.
Recently, I have started learning ember.js and I am really enjoying it.
Currently, I am working on a small project to practice my ember.js skills, but I seem to be having trouble with bindings.
If anyone could offer me some assistance, that would be greatly appreciated!
#------------------------Controller------------------------
App.ApplicationController = Ember.Controller.extend();
App.monstersController = Ember.ArrayProxy.create({
content: [],
//some code to populate content...
counter: function() {
var content = this.get('content');
return content.get('length');
}.property('length')
});
#------------------------View------------------------
App.StatsView = Ember.View.extend({
counterBinding: 'App.monstersController.counter',
#------------------------HTML------------------------
<script type="text/x-handlebars" data-template-name="application">
//some code goes here
{{#view App.StatsView}}Counter: {{counter}}{{/view}}
//I am hoping to display the length of the content array in App.monstersController above.
//more code can be added here
</script>