I'm developing an extension for browsers, hacking an web app which is 
developed with angularJS.

There is a module looks like:

  angular.module('Services').factory('testFactory', [ ..., function(...) {
    return {
      testFunc: function(){}
    }
  }]);

  Now I can inject a js script into the web app,  and want to overwrite the 
testFunc, so I tried in my script:
  
  var injector = angular.injector(['ng', 'Services']);
  var testFactory = injector.get('testFactory');
  var f = testFactory.testFunc;
  testFactory.testFunc = function() {
     f();
     // my own code for extra work
   };

   When calling testFunc in the web app, it seems still invoke the origin 
testFunc.

   What is wrong?  Can anyone help me? Thanks a lot in advance.

  BRs

-- 
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 angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to