Description
Bug Report or Feature Request (mark with an x
)
- [x] bug report
- [ ] feature request
Versions.
$ ng --version
_ _ ____ _ ___
/ \ _ __ __ _ _ | | __ _ _ __ / | | | |
/ ? \ | ' \ / _ | | | | |/ _
| '| | | | | | |
/ ___ | | | | (| | || | | (| | | | || | | |
// __| ||_, |_,||_,|| _|||
|___/
@angular/cli: 1.0.0
node: 6.9.2
os: win32 x64
@angular/common: 2.4.10
@angular/compiler: 2.4.10
@angular/core: 2.4.10
@angular/forms: 2.4.10
@angular/http: 2.4.10
@angular/platform-browser: 2.4.10
@angular/platform-browser-dynamic: 2.4.10
@angular/router: 3.4.10
@angular/cli: 1.0.0
@angular/compiler-cli: 2.4.10
Repro steps.
ng build
all is OK
ng build --prod
is KO since morning after update to angular/cli 1.0
I have one class Field with attributes :
export class Field {
key: string;
type: string;
label: string;
order: number;
fields: Array<Field>;
validators: FormValidators;
attributes: Attributes;
}
And this :
export class Attributes {
canBeCreated: boolean; // Apparait dans le formulaire de création
canBeEdited: boolean; // Apparait dans le formulaire de modification
canBeFiltered: boolean; // Apparait dans les filtres
canBeSorted: boolean; // Permet le tri sur la colonne
isInList: boolean; // Apparait dans la liste
isInDetail: boolean; // Apparait dans le détail
placeholder: string; // Texte qui apparait quand le champ est vide lors de la création ou modification
constructor (attr: Attributes) {
this.canBeCreated = attr && attr.canBeCreated ? attr.canBeCreated : true;
this.canBeEdited = attr && attr.canBeEdited ? attr.canBeEdited : true;
this.canBeFiltered = attr && attr.canBeFiltered ? attr.canBeFiltered : true;
this.canBeSorted = attr && attr.canBeSorted ? attr.canBeSorted : true;
this.isInList = attr && attr.isInList ? attr.isInList : true;
this.isInDetail = attr && attr.isInDetail ? attr.isInDetail : true;
this.placeholder = attr && attr.placeholder ? attr.placeholder : '';
}
}
export class CheckboxAttributes extends Attributes {
options: Array<{label: string, value: string}>; // Liste des valeurs possibles de les checkbox
isBinary: boolean; // Choix true/false ou multiple
constructor(attr: CheckboxAttributes) {
super(attr);
this.options = attr && attr.options ? attr.options : null;
this.isBinary = attr && attr.isBinary ? attr.isBinary : false;
}
}
In my component checkbox.component.html :
<div *ngIf="!field.attributes.isBinary">
.....
</div>
The log given by the failure.
ERROR in C:/Users/LAPASSAL/Projects/marty/src/$$_gendir/app/generic/components/checkbox-input/checkbox-input.component.ngfactory.ts (377,66): Property 'isBinary' does not exist on type 'Attributes'.
C:/Users/LAPASSAL/Projects/marty/src/$$_gendir/app/generic/components/checkbox-input/checkbox-input.component.ngfactory.ts (380,61): Property 'isBinary' does not exist on type 'Attributes'.
In typescript can I cast the object type to CheckboxAttributes with (this.field.attributes as CheckboxAttributes).isBinary ? false : []
but how can I do this in template? Any idea ?
Thx