- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2023 02:31 AM
Hi Experts,
I have a value in main widget which needs to be passed to another widget when I'm clicking on a button
HTML :
<button type="button" data-toggle="modal" data-target="#mydeletionModal" class="button-custom-2 btn-danger" ng-click="c.getAccountDetails(accNm)"><i class="fa-solid fa-trash"></i> Delete Selection</button>
below is the function in main widget
Client controller :
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2023 01:49 AM
Hi @raja_5 ,
it seems like there may be some issues with how you're trying to display the value in the second widget.
Here's how you can modify your code to pass the value from the main widget to the second widget:
In the main widget:
// client script
$scope.getAccountDetails = function(accNm) {
c.server.get({
accountNm: accNm
}).then(function(r) {
$rootScope.$broadcast('getaccount', accNm);
$scope.accountDetails = r.data.accountDetails;
});
};
In the second widget:
// client script
$scope.showaccount = {};
$scope.$on('getaccount', function(event, accNm) {
$scope.showaccount.accNm = accNm;
});
In the second widget's HTML, you can display the value like this:
<label for="account-name">Account Name</label>
<input type="text" ng-value="showaccount.accNm">
Thanks,
Ratnakar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2023 07:46 AM
Thank you for you help