Hacker News new | past | comments | ask | show | jobs | submit login

I just ran into another problem with Angular templates that illustrates the value of a templating system at least supporting the underlying implementation language's straightforward syntax and semantics for loops and conditionals and parameter passing, before going off and inventing all kinds of totally new unique special custom control structures, domain specific languages and micro-syntaxes, indirect ways to name and pass parameters, and other linguistic whoopee cushions:

How do I make an ngFor loop iterate through a range of numbers, without actually defining a literal array of numbers in the component for it to loop over?

https://stackoverflow.com/questions/36354325/angular-2-ngfor...

With Genshi, you simply do it the standard python way, since Genshi for loops are equivalent to Python for loops: <div py:for="i in range(count)">$i</div>

But I can't figure out how to, for example, use ngFor to iterate from 0 up to n, since it requires an array argument, and there isn't a c-like form like for (init; condition; repeat), or a standard JavaScript way to make a range like python's range(n).

Should I just give up and make a "range" utility method on my "God" service object that I'm passing in anyway? The more gaps like that I have to plug with my God, the more it becomes a God-of-the-gaps object.

https://en.wikipedia.org/wiki/God_of_the_gaps




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: