Hi,
I am working on Angularjs application. In that I write a button in controller that is :
propValue = “<button title = "{{‘Add’ | translate}}" class = ‘btn btn-xs btn-primary’ onclick = ‘openSaveRelAttr(item.properties.UID)’ >” +
“”;
So that this button I am able to see in each row of DHTMLX grid of my page.
In this , on click of this button I have to call the function openSaveRelAttr(item.properties.UID).
I write this function as follows: $scope.openSaveRelAttr = function (connectedUID) {
$stateParams.relUID = $scope.relUID;
$stateParams.relName = $scope.relName;
$stateParams.connectedUID = connectedUID;
$stateParams.className = $scope.className;
$uibModal.open({
animation: true,
controller: “itemDetailsCtrl”,
controllerAs: “$itemDetailsCtrl”,
templateUrl: “app/item/itemdetails/relationshipAttributeModal.html”,
size: “lg”,
backdrop: ‘static’,
resolve: {
items: function () {
return $scope.items;
}
}
});
};
But by Clicking on the button Uncaught ReferenceError: openSaveRelAttr is not defined
at HTMLButtonElement.onclick (localhost/:1) this error occurs.
So, how to call a function on clicking on this button. Please explain me with code.
I have attached the demo, please go through it.
Please see updated Demo
In this I used attachEvent on “OnRowSelect” and call the function.
Here, I used “OnRowSelect” so when I click on button or any other part of row it will call the function, so for this I used “onButtonClick” event but it is not working. I only want , on click of button I have to call the function. So, please explain me how to use"onButtonClick" event for calling function on button click.
I attached updated demo please go through it
Hii,
I try to write a function outside the controller function, but the $scope variables are not accessible outside the controller function. So, that things are not working here.Please tell me how to access $scope variables outside the controller.
DHTMLXDemo_updated.tar.gz (660 KB)
DHTMLXDemo (2).tar.gz (660 KB)
DHTMLXDemo.zip (661 KB)