forked from EmmanuelDemey/eslint-plugin-angular
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontroller-as-vm.js
More file actions
23 lines (19 loc) · 794 Bytes
/
Copy pathcontroller-as-vm.js
File metadata and controls
23 lines (19 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// example - valid: true
angular.module('test').controller('TestController', function() {
var vm = this;
vm.test = 'test';
});
// example - valid: false, errorMessage: "You should not use \"this\" directly. Instead, assign it to a variable called \"vm\""
angular.module('test').controller('TestController', function() {
this.test = 'test';
});
// example - valid: true, options: ["viewModel"]
angular.module('test').controller('TestController', function() {
var viewModel = this;
viewModel.test = 'test';
});
// example - valid: false, options: ["viewModel"], errorMessage: "You should assign \"this\" to a consistent variable across your project\: viewModel"
angular.module('test').controller('TestController', function() {
var vm = this;
vm.test = 'test';
});