Asynchronous testing with Mocha can be tricky to figure out and sometimes you’ll have unit tests passing successfully but really they were failing. So I’m going to share with you a trick to improve your Mocha unit tests to ensure that false positives are minimized and explain how promise testing works.
The AngularJS documentation is a little ambiguous about the differences between a service and factory. It doesn’t go into depth about the most common usage case for factories, and that’s how to use parameters to create new objects. I use factories so that I can inject a function into my AngularJS code that creates configured objects, and those objects hide a lot of the dependencies used by that object.
Here is a tutorial for the 7 best practices for working with $scopes in AngularJS. Keep the $rootScope clean of variables This rule is based on the idea that the $rootScope is a global variable and falls under the best practice that Global Variables Are Bad. Adding variables to the $rootScope will result in source […]