-
Notifications
You must be signed in to change notification settings - Fork 131
/
directive-restrict.js
43 lines (34 loc) · 1.23 KB
/
directive-restrict.js
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
// example - valid: true
angular.module('myModule').directive('helloWorld', function () {
return {
template: '<h2>Hello World!</h2>',
restrict: 'A' // also allowed: A, E, AE, EA
};
});
// example - valid: true
angular.module('myModule').directive('helloWorld', function () {
return {
template: '<h2>Hello World!</h2>'
// no explicit restrict is allowed by default
};
});
// example - valid: false, options: [{"explicit": "always"}], errorMessage: "Missing directive restriction"
angular.module('myModule').directive('helloWorld', function () {
return {
template: '<h2>Hello World!</h2>'
};
});
// example - valid: false, options: [{"explicit": "never"}], errorMessage: "No need to explicitly specify a default directive restriction"
angular.module('myModule').directive('helloWorld', function () {
return {
template: '<h2>Hello World!</h2>',
restrict: 'AE'
};
});
// example - valid: false, options: [{"restrict": "A"}], errorMessage: "Disallowed directive restriction. It must be one of A in that order"
angular.module('myModule').directive('helloWorld', function () {
return {
template: '<h2>Hello World!</h2>',
restrict: 'E'
};
});