- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2024 09:26 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2024 09:32 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2024 09:55 PM
We can use $emit, $broadcast and $on to send and recieve the data.
- Example by using $broadcast
Include below code in client controller on source widget to send data.
$rootScope.$broadcast('dataEvent', data);
Include below code in client controller on target widget to recieve data.
$scope.$on('dataEvent', function (event, data) {
console.log(data); // 'recieved data'
});
- Example by using $emit
Include below code in client controller on source widget to send data.
$rootScope.$emit('dataEvent', id);
Include below code in client controller on target widget to recieve data.
$scope.$on('dataEvent', function (event, data) {
console.log(data); // 'recieved data'
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2024 09:32 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2024 09:55 PM
We can use $emit, $broadcast and $on to send and recieve the data.
- Example by using $broadcast
Include below code in client controller on source widget to send data.
$rootScope.$broadcast('dataEvent', data);
Include below code in client controller on target widget to recieve data.
$scope.$on('dataEvent', function (event, data) {
console.log(data); // 'recieved data'
});
- Example by using $emit
Include below code in client controller on source widget to send data.
$rootScope.$emit('dataEvent', id);
Include below code in client controller on target widget to recieve data.
$scope.$on('dataEvent', function (event, data) {
console.log(data); // 'recieved data'
});