Repository navigation
Conversation
051c2c5 to
a3426cd
Compare
|
So I've build up a different approach based on some points that were bothering me. It's too big to be inlined on a comment so I created that gist. Concerns addressed
New ConcernWith that implementation the constructor looks like this : constructor(
private _viewContainer: ViewContainerRef,
private _template: TemplateRef<R>,
private _trackBy: TrackByFunction<T>,
private _differs: IterableDiffers,
private _updateContext: (context: LoopContext<T> | null, item: T, action: ItemAction) => void
) {}Seems like a lot of arguments, also the usage will require user to inject most of it on the Directive to just pass them by to that class. @Directive({
selector: 'myNgFor',
providers: [ ViewSyncService ]
})
export class MyNgFor {
@Input()
set trackBy(trackBy: TrackByFunction<T>) {
this.viewSync.setTrackByFn(trackBy);
}
constructor(private viewSync: ViewSyncService) {
viewSync.setUpdateContext( ... );
}
}Defining |
|
@ghetolay I have a few issues with with the mentioned changes. Making it a Directive
Directly managing ItterableDiffers
In general I think managing the As for my implementation I was thinking of providing an Observable that you can subscribe to for the |
I think you meant service not directive and I don't know if non-singleton directive are shakable or not. But as I have stated here #18015 I like that pattern but not as it is at the moment because if you forget
My idea here was since we need a
I stand my position here but I think we covered it, we just disagree and someone will have to make the call.
|
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Please check if the PR fulfills these requirements
What is the current behavior?
The code found inside
ngForOf's_applyUpdateis close to being generic for updating the DOM and non trivial. When someone wants to extendngForOfthey must re-implement this section of code which is almost always be the same. Apart from the context used, for this the class will need to provide a method to facilitate the context updates and creations.What is the new behavior?
By extracting this logic it centralizes the process of updating the DOM so that it's easy for people to extend upon
ngForOfor make similar Components/Directives aswell as to expand on in the future.Does this PR introduce a breaking change? (check one with "x")