#Functions in Template using Pipe

3 messages · Page 1 of 1 (latest)

polar hollow
#

Would it be a terrible idea to have a pipe along the lines of

transform<In, Out> (f: (x: In) => Out, x: In): Out {
    return f(x);
}

for pure functions to use angulars change detection mechanism?

I have a few places where I can't avoid calling a function in the template which is of course inefficient because it'll be called every time angular rerenders.
Using this it seems like a way to avoid that because angular does change detection on the inputs of the pipe (function) and doesn't call it again unless any parameters change

#

Functions in Template using Pipe

potent shard