

How AngularJS helped us ship our mobile site quicker - Part 1 (Directives) - geelen
http://goodfil.ms/blog/posts/2012/08/13/angularjs-and-the-goodfilms-mobile-site-part-1/

======
nl
I love Angular.JS, and I appreciate seeing more stuff about it.

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.

~~~
Pherdnut
I don't really get the point of coffeescript at all tbh. JS is one of the most
flexible languages in heavy use right now.

~~~
ebiester
Very simple: JS (module pattern, encapsulation) is verbose. CoffeeScript is
more compact, allowing for more code on one page. I toy with going back to JS
(I don't like everything about CS, especially with debugging and test tools in
node development) but CS optimizes for the good parts of JS and ignores the
parts I don't want to use anyway.

~~~
ceslami
As a guy who spends a lot of time writing JS, what are the good parts of JS
that CS optimizes for, and what are the parts it ignores that you do not want
to use?

------
aquark
Interesting -- but doesn't all that work to remove the 300ms delay mean make
the site totally broken on any browser that doesn't generate
touchstart/touchend/touchmove events?

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.

~~~
djb_hackernews
Fair point, but, I think people need to realize it's ok to only support
certain browsers. Every project doesn't need to support every browser from the
start. There are of course trade offs, but they mention they are targeting
Safari on iOS, and this is ok.

------
ben_h
Great post. I didn't understand the role of controllers and directives but
this explained them well with a thoughtful walk through.

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.

------
markus2012
AngularJS has been one of my pet projects recently.

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

------
eknuth
I'm curious about why people jump on angular without even checking out
knockoutjs. Knockout provides similar functionality with slightly less code.
The demo/doc site is incredible.

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.

~~~
clivestaples
The things that sold me on AngularJS over Knockout were built-in routing and
REST (via $resource). I feel like these things should be included in Knockout
and by using third-party solutions or attempting to roll my own would have
created more code/complexity than the AngularJS solution for my app.

------
MatthewPhillips
Custom attributes are a deal-breaker for me personally.

~~~
riffraff
is there a concrete reason for not liking them, other than the content
possibly being "non-valid"?

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?

~~~
ehutch79
they're not semantic. just like css classes are not semantic... also, ids are
not semantic either.

~~~
pygy_
... and neither is JavaScript.

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.

~~~
ehutch79
the sarcasm tag is also not semantic

~~~
pygy_
:-)

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.

~~~
ehutch79
poe's law?

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.

~~~
pygy_
True.

That's some cool stuff you make with your band, btw. What do you play?

------
kinleyd
Thanks, for me this was a great introduction to AngularJS. It looks good and
pretty mature as well. I look forward to evaluating it in more depth.

------
edwinyzh
AngularJS is the ONLY web front end framework that makes me _exciting_ , maybe
because I'm from a Delphi background ;)

