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
Post a Comment