2
schangxiang@126.com
2024-08-16 b47c50a2a514def7374b32d7194b2c599cba5625
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// ngGrid is also lazy loaded by $ocLazyLoad thanks to the module dependency injection !
var testModuleNoExt = angular.module('testModuleNoExt', []);
 
// config blocks
testModuleNoExt.config(function() {
  spy.config('config1');
});
 
testModuleNoExt.config(function() {
  spy.config('config2');
});
 
// run blocks
testModuleNoExt.run(function() {
  spy.run('run1');
});
 
testModuleNoExt.run(function() {
  spy.run('run2');
});
 
// controllers
testModuleNoExt.controller('TestCtrlNoExt', function($scope) {
  spy.ctrl('ctrl');
});
 
//
testModuleNoExt.factory('testServiceNoExt', [function () {
  spy.service('service');
  return {};
}]);
 
testModuleNoExt.filter('testFilterNoExt', function () {
  spy.filter('filter');
  return function (input) {
    return input;
  }
});
 
testModuleNoExt.directive("testNoExt", function () {
  spy.directive('directive');
  return {
    restrict: 'E',
    replace: true,
    template: '<div>Test template {{1 + 1}}</div>'
  };
});
 
// redefine directive to check that both won't be invoked (it would throw a [$compile:multidir] Multiple directives)
testModuleNoExt.directive("testNoExt", function () {
  spy.directive('directive');
  return {
    restrict: 'E',
    replace: true,
    template: '<div>Test template {{1 + 1}}</div>'
  };
});