initialization of JQuery plugins after ngRepeat and ngOptions

105 views
Skip to first unread message

Ján Koščo

unread,
Sep 27, 2013, 5:56:25 AM9/27/13
to ang...@googlegroups.com
Hello,

is there way to detect that ngRepeat and ngOptions are already compiled? 
I need to init jQuery Plugin which change value of selects. At first I had problem to even wait till ngRepeat is done.
I managed do that with directive and emiting information about it, but options are not ready yet. 


Thanks for any advices.

John

Sebastien Vincent

unread,
Sep 27, 2013, 6:46:17 AM9/27/13
to ang...@googlegroups.com
I suspect you doing it wrong, if you bind something with ng-model or ng-select, you shouldn't try to modify it directly in the DOM.
Also use scope.$watch rather than triggering event.

Try to turn off jquery to start with and implement your feature, then you'll figure out the right way more easily.

Ján Koščo

unread,
Sep 27, 2013, 6:57:43 AM9/27/13
to ang...@googlegroups.com
Hi Sebastien,

thanks for answer.

Not sure, how can scope.$watch help me here. Angular part is working just fine, but we use https://github.com/simsalabim/sisyphus to 
restore inputs from localStorage when browser crash and that's problem. What I need to know, is to are options rendered so I can init sisyphus. 


Dne pátek, 27. září 2013 12:46:17 UTC+2 Sebastien Vincent napsal(a):

Sebastien Vincent

unread,
Sep 27, 2013, 7:12:51 AM9/27/13
to ang...@googlegroups.com
The problem is that this plugin is updating the DOM. Maybe you want to write something similar to the plugin which restore the  the scope directly, otherwise anything which modifies the DOM and throw events around is trouble. You can use jquery features if they are properly encapsulated within a directive, but this one is leaking all over.

Ján Koščo

unread,
Sep 27, 2013, 8:43:06 AM9/27/13
to ang...@googlegroups.com
Thanks. I think I will disable "auto restoring" from localStorage and update $scope manully instead of trying to change DOM.

Dne pátek, 27. září 2013 13:12:51 UTC+2 Sebastien Vincent napsal(a):

Sebastien Vincent

unread,
Sep 27, 2013, 9:23:49 AM9/27/13
to ang...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages