AngularJS: an Overview
glennstovall.com
glennstovall.com
My current suspicion is that directives do not get the central billing that they deserve. If you come from other backgrounds, the first thing you wonder about is the whole MVC thing.
But then you look at compile phase, link phase and runtime loop. They are dominated by directives and the code that directives set up.
It seems to me that a big design step in AngularJS is to extend HTML into the DSL you wish existed. This is done with directives.
I'm still going through this process so it might well turn out that when I get to other parts of the manual my perspective will change entirely.
I see a lot of demos that throw together a few widgets -- but leave you no closer to anything remotely useful -- because they either include completely unsafe data across domains, or throw things in some kind of globally writeable store that isn't even useful for a public wiki, because there are no way to control anything that goes into the backend.
Does anyone have any good articles/sample projects to recommend?
All that said, I really enjoyed this article -- it does a great job of presenting the parts that angularjs is actually about: the client side.
I just sometimes feel tutorials focus too much on just angularjs - for most apps we want shared persisted data after all, right? (even if you're just sharing it with yourself, on a different client (eg: todo list in desktop browser and on mobile browser)).
[1] I just looked into couchdb again, and I think I'm getting a handle of how one might actually deploy the thing -- but it's a little scary to see that they by default turn off ssl cert validation -- which is just wrong -- when ssl is off by default anyway. Why would anyone enable SSL, but not want secure communication? For the slowdown?
[1] - End to End with Angular JS - http://www.youtube.com/watch?v=hqAyiqUs93c [2] - Security with Angular JS - http://www.youtube.com/watch?v=18ifoT-Id54
Just use Postgres if you don't have very specific, very unusual, and very well understood needs.
So you'll need some middleware, and there's no good reason why you shouldn't be able to keep your model and validation logic in one place - I'm guessing one of the easiest approaches, if you're using an sql database, is to use nodejs for the middleware, sharing as much as possible of validation and model-code between the api server and the client?
I think having to fix three different code-bases on every model change/feature addition is going to be a problem (SQL, PHP/Scala/Ruby/Python, and javascript + bonus fourth language if you use templates...). I'm not saying it can't be done, I'm saying there has to be a better way?
Here's just a few. .
VS SPA Breeze/Angular Template To Do app http://www.asp.net/single-page-application/overview/template...
Angular MVC Cookbook: https://github.com/Wintellect/Angular-MVC-Cookbook
I've used it and found their way of breaking it into steps really helpful.
One thing I'm always wondering is how people organize their code in an AngularJS project. The seed project and others have all directives in one file, all services is one etc. This quickly gets messy. Using different files for each, I have to include a lot of js files in the main page. Not sure what to do.
In our project, we created multiple sub-directories underneath the controller and services folders to organize them by business functions. It's fairly easy to re-organize the file structure in an angular projects.
Another good resource is a well made example app called angular-app [2], which includes security, a small backend, some crud pages, etc.
[1] - http://www.linemanjs.com
This blog explains more: http://www.alexrothenberg.com/2013/02/11/the-magic-behind-an...
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.4/angular.js"></script>
When https would have worked just fine. Instead, because it's referenced with http, we're basically saying - insert some random code in our page, if there's anyone that can spoof packets.It's like Microsoft Office Macros all over again -- only much worse.
Later he calls the github api over https -- but (and this is a genuine question, I don't know) -- what would happen if github redirected from https to http? Would it fail, or would we get random insecure data import?:
$http.get('https://api.github.com/repos/angular/angular.js/commits')
(Now, redirecting to http would obviously be, well, bad form at least -- but conceivable to stave off slashdotting by an overworked sysadmin, perhaps?).function(scope, element, attars)
Should be attrs.