How AngularJS helped us ship our mobile site quicker - Part 1 (Directives)
goodfil.ms
goodfil.ms
One thing I would like to see less of in introductory-type articles is Coffeescript.
I do understand the advantages of Coffeescript, but when one is trying to show off a framework like Angular.JS there is already quite a lot of non-obvious magic (eg: automatic dependency injection, the HTML compiler, etc etc) and introducing another thing that most people won't know well is a mistake IMHO.
If you like Coffeescript, then do a post about it, but mixing the two loses a lot of the audience.
I think it is probably fair to say your situation is fairly unusual.
How did that happen?
CS strips out a lot of that and makes the intention of the code clearer.
I guess you could code around this by catching the click event and deciding if you have already handled it, but that is beginning to feel like a lot of fragile and browser specific code that certainly isn't application specific.
I tried to access your mobile site from my phone but it wants me to sign in with either Facebook or Twitter before showing anything, so that was a non-starter.
I created dummy accounts to that end. See https://twitter.com/loganloginski
The idea of wrapping distinct chunks of logic in separate directives that can then be sprinkled around the DOM declaratively is great.
In my view this is a welcome alternative; in my (maybe limited) experience, many other JS frameworks have you writing substantial amounts of glue code (i.e. bug-magnet code) to achieve comparable things.
I really like the idea of creating new modules and directives and I've created a few of them. However, after creating a number of modules and directives I started to think that it would be nice to have a central repo so I can quickly look for and find new directives.
The angular ui project doesn't fit the bill as I just want to import specific directives into my project.
Some way to determine directive dependencies would be nice too :-D
I think it is also interesting that since backbone all the hot front end frameworks are of the model binding variety. Honestly when you do stuff like angular or knockout backbone just feels clunky.
I know that there are model binding plugins for backbone, but you still end up writing a bunch more code.
<html ng-app>
can be turned into a valid attribute by making it <html data-ng-app>
I'm really glad to see how quickly the AngularJS team is addressing concerns like these. AngularJS is moving very fast, and there is a lot of room for improvements in documentation. But a quick check with the changelog would have showed that AngularJS supports the use of valid custom attributes for directives almost half a year ago.I also feel somewhat dirty when using custom attributes, and I admit I preferred xmli-sh HTML and namespaces a-la ng:attr.. but is there any practical difference?
[1] http://wekeroad.com/2011/08/18/my-eyes-please-youre-killing-...
We're dealing with applications here, not documents, and even in the latter case, your views regarding ids and classes are extreme.
Angular templates, more than just markup, are the skeleton of your application. The markup they generate is as semantic as you make it.
Actually, I hesitated before posting... I had ruled sarcasm out because purely snarky posts are usually frowned upon here, and your parent post was asking a legitimate question...
That being said, we obviously agree on the topic.
In all seriousness though. That is kind of the correct answer to the parent. There's kind of this weird attachment to a whole bunch of weird 'best practices' in the design front. Many of them conflicting, many of them not well thought out. (There are some good ones coming out).
It's similar to twitter's bootstrap. Designers think it's horrible, if you believe the kind of blog with grey text on a grey background. But I can't believe people would recommend against it when they've seen the alternative.
That's some cool stuff you make with your band, btw. What do you play?