How can I send an object with $broadcast?

前端 未结 1 897
礼貌的吻别
礼貌的吻别 2021-01-03 19:12

I have the following:

$scope.$watch(\'tableForm.$pristine\', function (newValue) {
    $rootScope.$broadcast(\"tableDataUpdated\", 
        { state: $scope.t         


        
相关标签:
1条回答
  • 2021-01-03 19:38

    That's because listener function has two arguments being passed into it, event, and args. See the angular docs.

    Try:

    $rootScope.$on("tableDataUpdated", function (event, args) {
            alert(args.state);
        });
    
    0 讨论(0)
提交回复
热议问题