Thanks @westor for saving my day. I just updated my angular and started getting this problem, spent a lot of time fixing it, then found this. Therefore, I thought about some examples.
Using $ onInit in a controller function for a binding area
controller: function () { this.$onInit = function () {
In my application, I was tied through an area
myApp.directive('pendingRequests', function () { return { scope: { item:'=' }, bindToController: true, controller: controller, controllerAs: 'vm', controller: function ($scope) { console.log(this.item);
using required
myApp.directive('pendingRequests', function () { return { scope: {}, bindToController: {}, controller: controller, controllerAs: 'pendingReqCtrl', require: { parent: '^otherDirective' }, controller: function ($scope) { console.log(this.parent);
source share