So, I have an app setup where on an external page the user makes a change 
to the list and it is pushed back to the app and propagated through a 
broadcast event that is received in a service on a directive.

Setup on my core page
    var ngExternalInjector = angular.bootstrap(document, ["MyDirective"]);

Sent via post message
    var $rootScope = ngExternalInjector.get($rootScope");
    $rootScope.$broadcast("EventName", [data, function callback(pNewData) { 
}]);

Directive
    angular.module("MyDirective", [])
      .factory("MyService", function ($rootScope) {
        $rootScope.$on("EventName", function (pEvent, pData) {
          FuncHandleNewDataAndCallBack(pData[0], pData[1]);
        });
      });


The first time I go to the external page make a change and trigger the post 
message, everything works fine.  After that, every time I try to trigger 
the post message, the code gets to the broadcast, but the directive doesn't 
fire the $on event.  Is there something special I have to do to get this to 
work?  

Our 'core page' is never reloaded, we use an iframe (i know, it's an old 
app) for our inner pages.  I have the directive setup both on the core page 
and on the inner pages that we care about (and the directive elements 
include a link to the service).  The external page being loaded in the 
iframe is what sends the post message.  

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to