javascript - How to determiner a controller is available on the global namesapce in angularJS -


in order instantiate controller mock scope object in following unit test, need make sure controller available on global namesapce.

describe('testctrl', function(){    it('should create "phones" model 3 phones', function() {     var scope = {},         ctrl = new testctrl(scope);      expect(scope.phones.length).tobe(3);   });  }); 

however, how determine controller available on global namesapce in angularjs ?

a simple example, controller in root module app should on global namespace, , controller in dependency module products should ne non-global controller.

angular.module( 'app', [ 'products', ... ]);


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -