2

Upgrading to Angular 9 I got the followings errors related to a package:

Compiling @ngx-package : es2015 as esm2015

ERROR in Failed to compile entry-point @ngx-package (es2015 as esm2015) due to compilation errors:
node_modules/@ngx-package/@ngx-package.js:1325:34 - error NG1006: Cannot combine @Input decorators with query decorators

1325     'actions': [{ type: Input }, { type: ContentChild, args: [Component,] },],

The responsible code of this error is the following:

@Input() @ContentChild(Component) actions: Component;
Stefano Borzì
  • 1,019
  • 1
  • 15
  • 32

1 Answers1

0

The problem is that I can't combine @Input() and @ContentChild, so I replaced the code responsible of the error with the following:

get actions(): Component {
  return this._actions;
}

private _actions: Component;

@Input()
set actions(value: Component) {
  this._actions = value;
}

@ContentChildren(Component)
set viewActions(value: Component) {
  if (!this._actions && value) {
    this._actions = value;
  }
}

Stefano Borzì
  • 1,019
  • 1
  • 15
  • 32