

Hands-on Angular.js with Backlift part 1: Views and Controllers - colevscode
https://blog.backlift.com/entry/angular-tut1

======
bjourne
This is a really nice way to plug your product. :) Writing web applications
where the server is just a RESTful api that handles authorization makes a lot
of sense. Clean separation between models and views, easy to deploy almost
anywhere and easy to scale and cache. I've been using flask-restless to
accomplish something similar, but there is still some glue code you need and
sql to define database models.

Though it seems your collection api does not support arbitrary queries yet?
E.g. you can't fetch the last 10 blog posts or the highest rated comments by
user X? That are imho must have features for anything more than the most basic
web application.

Uniqueness validation seem to be missing too. E.g. currently no way to say to
a user that "a user with that username already exists"?

~~~
colevscode
Uniqueness validation is built into the collections API. If you attempt to add
a model with a duplicate ID you'll get a 400 error. In addition you can
specify validation rules in the config.yml file. Some additional info here:
[http://backlift.github.com/docs/validation.html#validation-r...](http://backlift.github.com/docs/validation.html#validation-
rule-reference).

As for query parameters on the collections API, we totally agree it's a must
and we're working on it.

------
kailuowang
I saw this quote on stack overflow that best summarize my experience with
Angular: in angular the easy stuff is really easy and the advanced stuff seem
disproportionally hard.

~~~
aidos
A quote that would be best served with an example....

~~~
kailuowang
Well, bi-directional data-bind is really easy. There is really minimum code
needs to be written. But when you need to create a reusable directive (widget
in Angular), it's hard to even find out where to start. You might need to
write many lines of boilerplate configuration code that takes quite a while to
learn and understand. In contrast, when you need to create a reusable widget
in Backbone, you can just write a view class like any other view class. To be
fair, it is in Angular team's plan to simplify directive development, so that
it will be like writing just another controller.

~~~
aidos
There's definitely a little more work involved in directives. I don't think
there's much boilerplate in writing them though. There's certainly more work
in understanding how they work initially, but that's a small price to pay for
the reusability they give you.

~~~
mc
I agree. At first glance there's a lot of shorthand (@, =, ^, ?, &) but that
knowledge comes with time. I experienced a lot of confusion with the compile()
and link() functions that I feel could have been prevented with better docs.
Until that's done, I recommend the path I took: lots of experimenting and
watching John Lindquist's videos over on egghead.io.

