1

In this post @yair-tavor posted snippets related to his SOAP interceptor module. Unfortunately, there is no clear and obvious example provided for obtaining an instance of the created 'myModule' object. I've already downloaded Yair's code from the Fiddle provided in that post, and included it in the HTML web page I'm developing. Being completely new to the AngularJS world (and learning more every minute!) I'd like to ask precisely HOW to obtain a local instance of that module/service.

I see that Yair's code includes this:

    /**
     * To be used by angular, this method retrieves new 
     * {{#crossLink "rtv.data.soap-interceptor"}}{{/crossLink}} instance.
     * @method $get
     * @returns {SoapInterceptor}
     * @for myModule.soap-interceptorProvider
     */
    providerInstance.$get = function(){
        return new SoapInterceptor();
    };
}]);

I've bookmarked this very helpful SO post for some detailed review, tomorrow: AngularJS: Service vs provider vs factory

So, I've tried to use the following syntax to obtain an instance, but it appears to return a module full of null objects, rather than the module I thought I was loading. :( Attempting to call soap.setWSDL using this module returns "TypeError: undefined is not a function".

    var soapModule = angular.module('myModule.soap-interceptor', [] );

soapModule:  { 
    _invokeQueue: 
        [  ]
    _runBlocks: 
        [  ]
    requires: 
        [  ]
    name: soapModule.soap-interceptor
    provider: null
    factory: null
    service: null
    value: null
    constant: null
    animation: null
    filter: null
    controller: null
    directive: null
    config: null
    run: null
 } 

Nor does calling it without the second argument, which returns an error saying the module is not available.

    var soapModule = angular.module('myModule.soap-interceptor');

    Error: [$injector:nomod] Module 'myModule.soap-interceptor' is not available! 
    You either misspelled the module name or forgot to load it. If registering a 
    module ensure that you specify the dependencies as the second argument.

So, how exactly SHOULD I be loading and hooking into Yair's soap-interceptor module? I need a valid non-null instance of it, in order to successfully execute the "setWSDL" method which loads the WSDL content.

Community
  • 1
  • 1

0 Answers0