CreativeIT / getmdl-select

Select for material-design-lite
http://creativeit.github.io/getmdl-select/
MIT License
301 stars 87 forks source link

getmdl-select isn't working with AngularJS ng-repeat list (Dynamic list) #73

Closed AmitBenAmi closed 6 years ago

AmitBenAmi commented 6 years ago

I'm working now with AngularJS 1.6 and set the li with ng-repeat. The component works but when selecting a value the field (input) not showing what value I selected, and also the ng-model which I've bound isn't getting the real selected value. After some debugging and seeing what your code does, I figured out what should be done. Knowing when AngularJS finishes rendering the ng-repeat list, I called getmdlSelect.init(.getmdl-select), which solved my problem, because on load the foreach loop in the getmdlSelect can't find any li elements (Angular still didn't rendered it yet), thus the _addEventListeners that called in the getmdlSelect.init finds empty list of li elements. When knowing when AngularJS finished rendering and re-calling the getmdlSelect.init function with the .getmdl-select class, now the _addEventListeners can find all of the rendered AngularJS dynamic list of li. That solved my problem and maybe should be noted on your site

alexbananabob commented 6 years ago

Thanks you @AmitBenAmi for you feedback. However, we wrote about it in Dynamically usage section

AmitBenAmi commented 6 years ago

Hi @alexbananabob, You’re right, didn’t noticed that Thank you!

Sent from Mail for Windows 10

From: Alex Bobko Sent: Tuesday, January 9, 2018 7:48 PM To: CreativeIT/getmdl-select Cc: Amit Ben Ami; Mention Subject: Re: [CreativeIT/getmdl-select] getmdl-select isn't working withAngularJS ng-repeat list (Dynamic list) (#73)

Thanks you @AmitBenAmi for you feedback. However, we wrote about it in Dynamically usage section — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.