canjscanjs-component

how can can.component returning value to user?


Problem: I am building a component where i just need output json object. How can i expose that output so that code can just call component and retrieve that value? (eg. like a getter value)

For e.g. can.component of tree combo as defined over here (http://canjs.com/docs/can.Component.html) allows to select the values. How can i retrieve back those selected values from can component to use it further in my code ? Like some method which would return me all the values selected which i can reuse it later to pass to some function doing some other computation.


Solution

  • Have a look at https://github.com/bitovi/canjs/issues/1209, there are are several ways to accomplish this. Mainly you have three ways: