-
Notifications
You must be signed in to change notification settings - Fork 131
/
Copy pathno-inline-template.js
55 lines (48 loc) · 1.9 KB
/
no-inline-template.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// example - valid: true
angular.module('myModule').directive('helloWorld', function () {
return {
templateUrl: 'template/helloWorld.html'
};
});
// example - valid: true
angular.module('myModule').directive('helloWorld', function () {
return {
template: '<div>Hello World</div>' // simple templates are allowed by default
};
});
// example - valid: true
angular.module('myModule').config(function ($routeProvider) {
$routeProvider.when('/hello', {
template: '<hello-world></hello-world>' // directives for routing
});
});
// example - valid: false, errorMessage: "Inline template is too complex. Use an external template instead"
angular.module('myModule').directive('helloWorld', function () {
return {
template: '<div>Hello World! <button>Say hello!</button></div>'
};
});
// example - valid: true, options: [{"allowSimple": true}]
angular.module('myModule').config(function ($routeProvider) {
$routeProvider.when('/dashboard', {
template: '<dashboard></dashboard>' // directives for routing
});
});
// example - valid: false, options: [{"allowSimple": true}], errorMessage: "Inline template is too complex. Use an external template instead"
angular.module('myModule').config(function ($routeProvider) {
$routeProvider.when('/dashboard', {
template: '<div><h1>Dashboard</h1><dashboard></dashboard></div>'
});
});
// example - valid: true, options: [{"allowSimple": false}]
angular.module('myModule').config(function ($routeProvider) {
$routeProvider.when('/dashboard', {
templateUrl: 'templates/dashboard.html'
});
});
// example - valid: false, options: [{"allowSimple": false}], errorMessage: "Inline templates are not allowed. Use an external template instead"
angular.module('myModule').config(function ($routeProvider) {
$routeProvider.when('/dashboard', {
template: '<dashboard></dashboard>'
});
});