InfomediaLtd / angular2-materialize

Angular 2 support for Materialize CSS framework.
https://infomedialtd.github.io/angular2-materialize/
MIT License
407 stars 140 forks source link

Dynamic MaterializeParams #279

Open AlejandroPeralTaboada opened 7 years ago

AlejandroPeralTaboada commented 7 years ago

Hi

I have a problem using materializeParams when I try to modify them. I've been reading in different issues and it seems that it's necessary to change the reference of the object, however it doesen't work for me.

That's the relevant part of my code

The template

<input formControlName="date" type="date" class="datepicker" materialize="pickadate" [materializeParams]="[params]">

The component

Declaration

params = {min: new Date(), disable: [6,7]};

An Async function that is called sometimes and changes the disable array

function asyncFunction(newArrayOfDisableDays){
this.params.disable =newArrayOfDisableDays;
/*
  Things I tried after this
  this.params = Object.assign({},this.params);
Another attemp
 this.params = JSON.parse(JSON.stringfy(this.params));

Also tried to make this.params an event emitter and use in the template the pipe async, still no working
*/
}

Those are my software versions of materialize

"angular2-materialize": "^15.0.1", "materialize-css": "^0.98.2"

I'm sure I am missing something.

Thanks in Advance

rubyboy commented 7 years ago

I can see that it's indeed not updating the config. Not sure why. @criticalbh , are you able to assisthere?

rubyboy commented 7 years ago

Same problem as https://github.com/InfomediaLtd/angular2-materialize/issues/280 and https://github.com/InfomediaLtd/angular2-materialize/issues/127

criticalbh commented 7 years ago

@rubyboy I will.