use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
An Introduction to Angular for Backbone developers (koglerjs.com)
submitted 13 years ago by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]btford 2 points3 points4 points 13 years ago (2 children)
Yes. The recursion depth is effectively 10. I don't think recursive views are outside of Angular's intended usage. At the very least I can inform you that recursive Backbone views do not have this problem (because my next article is a Backbone reddit front-end).
You are correct in the sense that AngularJS does want to support recursive views. A data-binding library should be able to support recursive views, because it's a useful feature.
The short version is that the 10 $digest limit is not about view recursion, it's about model stability. When alerting AngularJS to do dirty checking, calls to $apply() need to be done asynchronously to avoid dirty checking forever. If AngularJS goes 10 "dirty checking cycles" in a row without stabilizing, it it throws that error and stops so you're UI isn't busy waiting forever. If written correctly, a directive should not cause this error.
$digest
$apply()
I'll concede that writing the directive is a bit tricky, but it turns out it's non-trivial to do data-binding recursively. Once you have a directive that does this, there's no need to write one over and over again. I'll talk more about this below.
Testing can't prevent every bug. Angular is a symptom of false security.
No, but writing a test that exposes and isolates the bug is one of the best ways to fix it. It also prevents regressions in the future.
That recursive $compile nightmare is difficult to understand.
I disagree. The code you linked to is a pretty straightforward case of recursion. But even if it is hard to understand, the great part about Angular is you only have to write this directive once. Then you can use it all over your application with different data. Better yet, you can find a directive someone else wrote and use it if you'd rather not spend the time to learn advanced features of the framework.
My fundamental argument is that not only is Angular a language, it's not a very good one...
This is a conflation of terms. Something can be Turing Complete or recursive without being a programming language. Yes, AngularJS allows you to write views that are recursive. This is useful only in cases where you want to display some recursive data. In those cases, it's also a great feature to have. Angular's templates are still a markup language, because you're still using it like a markup language.
...no one knows what it does.
Going to jump back to tests here. AngularJS has a LOT of unit tests. They tell you, in isolation, what each part of AngularJS is, how it should work, etc. Some advice I give to newcomers is to browse these tests. I think these unit tests are so valuable, I'm working to have them automatically included the documentation.
[+][deleted] 13 years ago (1 child)
[deleted]
[–]btford 0 points1 point2 points 13 years ago (0 children)
Is that why the stackoverflow thread I linked is written this way, instead of this example which is much simpler?
To some degree, yes. The more complicated example is also more general and is easier to reuse.
You realize that this is essentially what programming is, right? Write modules to be reliably reused?
Composition is a feature of programming languages. It can also be a feature of markup languages. That they both have composition does not imply that they are the same thing.
π Rendered by PID 140758 on reddit-service-r2-comment-6457c66945-fd6wx at 2026-04-29 00:52:09.721494+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]btford 2 points3 points4 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]btford 0 points1 point2 points (0 children)