1
votes

I am learning ember.js and flame.js for the first time, and am having trouble understanding some of the documentation. I have a flame widget (a button) which when clicked, should send a argument (the number 1) to the function specified in action. The flame code is given below:

           numButtonView: Flame.ButtonView.extend({
                layout: { left: 150, width: 20 },
                title: '4',
                targetBinding: '^controller',
                valueBinding: '^controller.num',
                action: 'numDisplay'
            })

and the ember function right now looks like this:

App.calcController = Ember.Object.create({
    var num = null;

    numDisplay: function(num){
         ......
    }
});

How do I pass the 'argument' from the widget to the function? I would be glad for any help,..thanks in advance!

EDIT: I am trying to set the 'num' value in the controller to 1 by clickng the button. For this, I have used 'valueBinding' to bind the button to 'num'. But, how do I get the value 1 to be associated with this button and 'num'?

1

1 Answers

0
votes

You'll need to have your numDisplay function be listed in the controller's actions:

Ember.Controller.extend({
  actions: {
    numDisplay: function(num){
      ......
    }
  }
});