You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider the following line of my app <input [(ngModel)]="costprice.name"... <label for="name" [class.active]="costprice.name || invalidKeys['name']">Name</label>
Issue:
class.active is not set even if costprice.name value exists.
Reason:
Before I had no issue, then I added later in the template a select with materialize="material_select" and the issue appeared. Apparently because of that materialize= that performElementUpdates is called and so updateTextFields, at the wrong moment.
I guess somehow the flow is :
(after costprice object is resolved)
Process class.active logic
ngAfterViewInit kicks in, performElementUpdates and updateTextFields are called but as the [(ngModel)]'s value is not yet filled in the input, class.active is removed by Materialize
[(ngModel)]'s value is filled
Conclusion my class.active logic is overridden.
My solution for now was to remove the line materialize-directive.ts#L94 to perform updateTextFields myself.
But I am not happy with the solution...
Is my code wrongly designed ?
Is materialize-directive.ts#L94 legitimate ?
Any idea for a better solution ?
The text was updated successfully, but these errors were encountered:
Hi
Line:
https://github.com/InfomediaLtd/angular2-materialize/blame/master/src/materialize-directive.ts#L94
Consider the following line of my app
<input [(ngModel)]="costprice.name"...
<label for="name" [class.active]="costprice.name || invalidKeys['name']">Name</label>
Issue:
class.active is not set even if costprice.name value exists.
Reason:
Before I had no issue, then I added later in the template a select with
materialize="material_select"
and the issue appeared. Apparently because of thatmaterialize=
thatperformElementUpdates
is called and soupdateTextFields
, at the wrong moment.I guess somehow the flow is :
(after costprice object is resolved)
[(ngModel)]
's value is not yet filled in the input, class.active is removed by MaterializeConclusion my class.active logic is overridden.
My solution for now was to remove the line
materialize-directive.ts#L94
to performupdateTextFields
myself.But I am not happy with the solution...
Is my code wrongly designed ?
Is
materialize-directive.ts#L94
legitimate ?Any idea for a better solution ?
The text was updated successfully, but these errors were encountered: