Hello, I would like to pass a binded parameter to a function. The binded
parameter is printed fine in HTML, but when the function is invoked the
parameter is not passed.
*Example, the controller code:*
tigerApp.controller('TigerCtrl', function ($scope) {
// Some dummy data just for example.
$scope.statistics = [
{'sec': 'VALE5', 'pl': '0', 'vol': '0', 'pos': '0', 'lvs':
'0', 'bid': '', 'ask': '', 'sta': 'Stopped', 'staCl': 'stopped'},
{'sec': 'PETR3', 'pl': '0', 'vol': '0', 'pos': '0', 'lvs':
'0', 'bid': '', 'ask': '', 'sta': 'Stopped', 'staCl': 'stopped'}
];
// Just opens a new window with URL configured. The security
parameter is not being passed...
$scope.openOrderForm = function (type, security) {
var setupId = $("#setup").val();
var qty = 1;
var url = "/system/secure/trade/order-form.jsf?"
+ "type=" + type
+ "&qty=" + qty
+ "&setupId=" + setupId
+ "&security=" + security;
var name = "window-" + setupId + "-" + getSequence();
openWindow(name, url, type);
};
});
*The corresponding HTML code:*
<tbody class="ui-datatable-data ui-widget-content">
<tr ng-repeat="st in statistics" class="{{$index % 2 == 0 ?
'ui-datatable-odd' : 'ui-datatable-even'}}">
<td class="ha-center" style="font-weight:
bold">{{st.sec}}</td>
<td class="ha-center">
<button data-pui-button="" type="button"
ng-click="openOrderForm('BID', '{{st.sec}}')"
class="font-mini">BID</button>
</td>
</tr>
</tbody>
The HTML code is printed fine, with the ng-click showing the corresponding
binded parameter:
<button data-pui-button="" type="button" ng-click="openOrderForm('BID',
'VALE5')" class="font-mini">Bid</button>
The problem is when the button is clicked, the parameter 'VALE5' is not
passed to the function. The value '{{st.sec}}' is passed instead!
How can I fix this problem?
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.