Categories: AngularJS, Software Development

Top 3 Influential AngularJS Bloggers

Today we’re looking at the top three AngularJS bloggers. They’ve been writing a lot of tutorials, how-tos and all sorts of guides to make it easier for the rest of us to solve our problems with AngularJS. What I appreciate about these AngularJS bloggers is that they are not afraid to do a deep-dive and explain the inner workings of Angular to increase performance and to increase our understanding of the framework.

UPDATE: I forgot someone!

Ben Nadel

Ben Nadel has been writing AngularJS articles for…since forever (2012) it looks like and in great depth too. He wrote a good article covering performance of $scope.evalAsync and even wrote his own replacement for $resource/ngResource called httpi.

AngularJS Bloggers

1. Todd Motto

A developer at Google working with AngularJS every day it seems, Todd Motto is writing quite a bit on Angular and JavaScript in general. His opinionated AngularJS style guide for teams was popular on reddit and hacker news and has inspired AngularJS devs to think about writing their own style guides based off of his style guide.

He also has a nice article on creating an AngularJS directive from one of your existing plugins/scripts.

2. Year of Moo

They don’t post articles about AngularJS often but when they do, they’re full-on guides that cover a lot and contain many useful ideas.

One of their most popular articles is about unit testing, end2end testing and midway/integration testing with AngularJS. This article is the standard reference that is linked to everywhere whenever unit testing in AngularJS is discussed.

3. Misko Hevery

The father of AngularJS posts non-stop on Twitter about Angular and how it works with Dart, Google’s JavaScript-based language. He re-tweets many great articles that can help you when developing AngularJS apps, and he has over 10,000 followers.

More Places To Get Your AngularJS Fix!

Overall it’s hard to find out who’s the most influential, there are more and more people checking out AngularJS every day and it’s a decentralized community, you can find great information in all sorts of places.

If you’re learning AngularJS or becoming a master, check out the Learning AngularJS newsletter.

If you want to keep up with AngularJS bloggers and the latest news in the AngularJS community, check out ng-newsletter.

Categories: AngularJS, Software Development, Web Dev Training

AngularJS: testing services that use $resource

In this article we discuss one aspect of AngularJS testing, namely how to unit test code that uses $resource.

When working on a project that uses ngResource (imported into the code as $resource), the unit tests related to the service relying on $resource were failing. I jumped in to do a rewrite or to scrap them entirely if necessary.

  1. The Problem: how to test a service that relies on $resource
  2. Unit Tests Vs. Integration Tests
  3. The Solution: break the dependency and test each part separately
Continue reading “AngularJS: testing services that use $resource”
Categories: AngularJS, Web Dev Training

A Primer on AngularJS Services

The article is by Michael Herman it’s a very nice short article on how to use AngularJS services.

The article talks about what a service is and how to create one. It’s very well done and the code is easy to follow and understand.

When you’re first starting with AngularJS it can be tempting to put a lot of functionality into a controller, but you should be separating concerns and moving some of that functionality into separate services that the controller uses. Even for small apps, it’s good to get into the habit of creating separate services.

As Michael says,

“If your controller is handling more than just defining the scope or initial state of your app, connecting your models and views, then it’s are probably doing too much.”

The article is a prime example of great documentation of a core AngularJS feature.

Read the article

See a demo of the code in action.

Hope this article helps you a lot on your journey to become an AngularJS master!

Categories: AngularJS, Portfolio, Software Development, Web Dev Training

Deconstructing AngularJS Injector

I was reading through Coders at Work and realized that I haven’t done much code reading lately, other than reading through code samples in tutorials and articles. The interviews in the book suggested that code reviews and code reading are one of the most important things you can do as a professional programmer. This gave me the idea to write this article on the Angular injector.

I’ve been doing some stuff with AngularJS and one of the key ideas is dependency injection. Here’s a deconstruction of Angular injector.js which contains all the functions and classes for dependency injection.

Continue reading “Deconstructing AngularJS Injector”

Common AngularJS Project Structures

Common AngularJS Project Structures

Just a page documenting some AngularJS project structures that I’ve seen on github and in tutorials and books and other articles. Instead of trying to provide a one-size-fits-all project like angular-seed does, it’s better just to document what’s out there and let people choose what makes the most sense for them.

For example, a small tutorial doesn’t need a full angular-seed type structure, it can use the same project structure as my own tutorial which is just a few files bundled together.

Some other AngularJS-related posts:

Categories: AngularJS, Portfolio, Software Development

Writing an AngularJS Tutorial, First Draft is up

The state of the AngularJS tutorials and API docs is not that great. I’ve had to look through two books and many tutorials just to understand the basics and instead of simply complaining, I decided to do something about it.

So here it is, my Learning AngularJS tutorial. It shows you how to setup an AngularJS project, what you need for testing, how to create a controller and how to use some of the more common directives, such as ng-repeat, ng-click, select, ng-bind, and ng-model.

The repo contains an HTML version and an ODT (OpenDocument text) version. There’s also the org-mode file used to create those versions. More importantly, all the code in the tutorial has been done in a literate programming fashion. Whatever you see in the tutorial has been assembled together and fully tested. All of the code is in the repo.

Update July 2017: You can check out the differences between Angular 2/4+ vs AngularJS 1.x here. I am planning on writing another tutorial using the latest version of Angular using the same literate programming style.

Categories: AngularJS

Snippet of AngularJS for data models

AngularJS Hackathon
AngularJS Hackathon (Photo credit: fumi)

Evil Trout has a blog post comparing AngularJS to EmberJS and one of the examples seems off from what I understand so far about AngularJS. It’s in the section, “What’s wrong with JavaScript primitives as models?” where the concept of the model is compared.

The example in the blog post seems off only because Evil Trout is astounded that AngularJS lets you use plain JavaScript objects as models. If you want to add an observer to a property, you have to do it yourself, Angular won’t do it for you. EmberJS provides an Object class that can be extended, which isn’t a plain JavaScript object.

This can cause maintainability nightmares down the road. Over time, in a large software project, you will inevitably want to replace something that was previously a primitive with a method. In Ember you can do this painlessly; in AngularJS you’ll have to update every template where that model is used.

That’s your own fault if you aren’t using a getter/setter pattern in AngularJS. As my example shows, you don’t have to worry much since when you’re updating the model presumably it’s attached to a $scope in a controller. Thus, the controller’s $scope can  watch the model for updates.

Here’s some code on JSFiddle showing how I would implement a Room model. When the width and height change, the area property is updated in the controller.

Categories: AngularJS

AngularJS vs EmberJS Notes

Just watched a video from Norwegian Developers Conference, “EmberJS vs AngularJS” and it’s a code battle between two developers (one of whom is the lead developer of EmberJS) demonstrating the basics of each framework. The AngularJS code wasn’t as good as it could have been.

Continue reading “AngularJS vs EmberJS Notes”