\$rootScope.\$on is not listening to the event broadcasted

chandrashekar3
Giga Contributor

Hi All,

I have braodcasted an event in a widget, but the $on is not listening to the event

below is my code, let me know for any mistakes

Broad cast event

function($scope, $http, spUtil, $rootScope, $sce) {

  /* widget controller */

  var c = this;

this.onClick = function($event){

$rootScope.$broadcast('prepopulateItem', c.data.task_sysid);

};

}

Listening event in SC Catalog Item widget

$rootScope.$on('prepopulateItem', function(event,obj) {

$scope.data.sc_cat_item._fields["IO:8d23d26fdbbab24096fcf9971d961955"].value = 'complaint';

$scope.data.sc_cat_item._fields["IO:44b71623db3eb24096fcf9971d961922"].value = 'Option_case_Ticket';

$scope.data.sc_cat_item._fields["IO:02dde3afdb76364096fcf9971d96199d"].value = obj;

});

7 REPLIES 7

Venkat122
Kilo Guru

The above two widgets placed on same page?


Hi Giri,



The above two widgets are in different pages.



Thanks and Regards,
Chandrashekar BN


Once test by keeping widgets in same page and try whether communication is happening or not.


Hi,



I tried in my personal instance by adding the widgets in same page and It was listening.


But my requirement is to send the information from widget in one page to widget in another page.


Can this be accomplished?



Thanks and Regards,
Chandrashekar BN