1

Since update to AngularJS 1.7 (from 1.6) there seem to a breaking chance or at least something we did wrong and now results in an undefined issue.

I tried to consult AngularJS changelog, searched and tried a lot but cannot find the solution.

Directive Call - it's verified that myAllocation is not null and has all required properties

<ac-allocation ac-allocation="myAllocation"></ac-allocation>

Directive Code

function acAllocation(SomeService) {

return {
  restrict: 'E',
  replace: true,
  scope: {
    allocation: '=acAllocation'
  },
  controller: acAllocationController,
  controllerAs: 'vm',
  bindToController: true,
  templateUrl: 'components/some.html'
};

function acAllocationController() {
  var vm = this;

  if (vm.allocation) {

  // this fails as vm.allocation is not defined anymore, but it used to be
  }
}
}
LBA
  • 3,859
  • 2
  • 21
  • 60

1 Answers1

1

Found it :-(

Since I removed the preAssignBindingsEnabled flag as it was deprecated and now removed in AngularJs 1.7 this breaking change from AngularJs 1.5 to 1.6 is now hitting us:

So in our case I have to use now:

function acAllocationController() {

  this.$onInit = function() {
    var vm = this;
    if (vm.allocation) {
    //...

to be sure bindings are available.

My issue is now (and it should have been my issue already months back, but I didn't see it):

How to identify all other potential directives where this could hit me? :-(

LBA
  • 3,859
  • 2
  • 21
  • 60