material icon indicating copy to clipboard operation
material copied to clipboard

Directives inside md-virtual-repeat not updating the controller scope

Open neo-wanderer opened this issue 11 years ago • 4 comments

http://codepen.io/anon/pen/JYZEPm

I am using a directive inside the virtual repeat container. The directive controller manipulate the data inside the controller and applies to the template. However, the controller is called only a few times and then the directive controller instead of calling it for every md-virtual-repeat item.

neo-wanderer avatar Oct 30 '15 08:10 neo-wanderer

Update: As a work around, I am using a function in the template to get the data. http://codepen.io/anon/pen/rOKjwZ

If some could tell me if this is the right approach, it would be greatly appreciated.

neo-wanderer avatar Oct 30 '15 09:10 neo-wanderer

This looks like intended behavior. I'm not sure exactly what you're expecting but it is intended that the virtual repeat recycles rather ran destroying and recreating elements (which is what ng-repeat does). As such, you'll need to do your work in a scope watcher rather than at startup if you want it to work properly in virtual-repeat.

kseamon avatar Nov 02 '15 20:11 kseamon

@vigneshnrfs as I was looking at this too, I've forked your codepen to produce an implementation that does what @kseamon describes above. Hope this helps.

mtlewis avatar Nov 02 '15 22:11 mtlewis

@mtlewis Thanks a lot.

neo-wanderer avatar Nov 02 '15 23:11 neo-wanderer