What does module function do in AngularJS? -


in project of vojta testing directives code ?

  // load tabs code     beforeeach(module('tabs'));  

it says loads tabs code but, why ? isn't tabs module defined next here ?

 var tabs = angular.module('tabs', []); 

can 1 give brife explanation of should loaded why , how in angular test ?

i tried call function in tests,

 beforeeach(module('utils')) ; 

and error :

typeerror: property 'module' of object [object object] not function 

also when try load templates

beforeeach(module('templates/loadingbar.html'));  

i error :

error: no module: templates/loadingbar.html  

i confused whole process.

thanks helping ...

the code listed

var tabs = angular.module('tabs', []); 

creates tabs module, in order load put ng-app="tabs" on element in dom. instructs angular load tabsmodule , make definitions available injector app uses resolve dependencies. (see bootstrap guide more information.)

in tests, there no ng-app directive initialize injector or load module; module function (which exists on angular.mock angular-mocks.js file) in tests. if use karma jasmine or mocha adapter testing, makes module available you, otherwise may need call angular.mock.module instead.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -