LStarky
LStarky

Reputation: 2777

Aurelia property-observation warning when using @children

I'm getting the following warning when using the @children decorator:

vendor-bundle.js:14294 WARN [property-observation] Cannot observe property 'columns' of object

My custom element code is:

@children('data-grid-column') columns = [];

I'm trying to bind it to this view-model so that I can get an array of objects with the column data:

import {bindable, noView} from 'aurelia-templating';

@noView
export class DataGridColumn {
  @bindable name;
  @bindable display;
  @bindable align;
}

It works perfectly, but the error seems to indicate something is wrong. I have no need for property-observation here, but would like to know why I'm getting the error.

<data-grid data.bind="records">
  <data-grid-column name="acc_code" display="Code"></data-grid-column>
  <data-grid-column name="acc_name_orig" display="Account"></data-grid-column>
</data-grid>

Upvotes: 0

Views: 66

Answers (1)

Fabio
Fabio

Reputation: 11990

It seems to be a known issue that has been already fixed. I think this warning will be gone in the next aurelia-templating release. See https://github.com/aurelia/templating/issues/520

Right now, it doesn't happen if you use @children at the class level.

@children({ name: "columns", selector: "column" })
export class DataGridColumn {
  //...
}

Upvotes: 1

Related Questions