It works when I use a plain String, the ng-dblclick function is able to find the controller's function and execute it. The code below works and the modalShown is set correctly.
<tr ng-repeat="product in searchResults" ng-dblclick="editProductCopy('123456-010','HO2013');">
<td><input type="checkbox" value="2" checked></td>
<td>Spring 2013</td>
<td>{{product._id}}</td>
</tr>
However it doesn't work in this scenario when I use model binding within a ng-repeat. I tried invoking it with $parent. editProductCopy but could not get it to work
<tr ng-repeat="product in searchResults" ng-dblclick="editProductCopy('{{product._id}}','HO2013');">
<td><input type="checkbox" value="2" checked></td>
<td>Spring 2013</td>
<td>{{product._id}}</td>
</tr>
The controller code is :
function ProductSearchCtrl ( $scope, $routeParams,ProductSearch) {
$scope.modalShown = false;
$scope.editProduct = null;
$scope.searchResults = [];
$scope.clickCount = 0;
$scope.searchProducts = function ( season,division,category) {
$scope.searchResults = ProductSearch.query({'season':season,'division':division,'category':category});
};
$scope.editProductCopy = function ( productCode, season ) {
$scope.modalShown = ! ($scope.modalShown );
$scope.clickCount = $scope.clickCount + 1 ;
$scope.editProduct = { productCode:productCode, season:season, styleName : 'Test Style Name'}
};
}
I am sure it is due to the new scope created by the ng-repeat tag,but I am not sure how to invoke the call to the controller's function.
Any help is highly appreciated,