I have a controller that depends on another controller (for settings info). I'm trying to use the Controller As pattern but I get an injection error.
Here's my controllers:
angular.module('app2', [])
.controller('ctrl1', [function () {
var controller = this;
controller.value = 6;
}])
.controller('ctrl2', ['ctrl1', function (ctrl1) {
var controller = this;
controller.testValue = 5;
controller.runTest = function () { return ctrl1.Value * 2; };
}])
And here's how it's used
<body ng-controller="ctrl2 as ctrl">
{{ ctrl.runTest() }}
</body>
I saw this article here but it didn't seem the same and I couldn't figure out how to get that solution working: AngularJS How to inject dependencies when using controller-as syntax