Angular Form Validation - Part 1 - ngModel Controller

Form validation the "Angular way" is an extremely powerful tool. We have the ability to pass a simple regular expression to the ng-pattern attribute of the input field for simple input validation, or we can make our own custom validation functions utilizing the NgModelController. So you might be thinking to yourself yeah, but I can already use a pattern for validation in html5. True, indeed you can, but when you couple all the bits and pieces together and let Angular do its thing you have a complete tool set at your disposal. In this post I wanna show how we...

You too can write a selector engine

Ok so the title is a bit misleading. Yes, it is possible to write selector engine, but when we talk about a selector engine as complex as Sizzle then it's another story. Don't get me wrong I am not saying your JS skillz aren't up to the task, but it's a pretty heavy task considering the back browser compatibility and all the methods that come bundled along with the selector engine. Recently my vanilla JS skills were tested and I realized - well - they could be better. We have had the crutch, if you wanna look at it that...

Mocking Controller Instantiation In AngularJS Unit Test

Being able to mock is what unit testing is all about this paradigm plays an especially important role in AngularJS unit testing. We mock our application's environment. We mock data using constants. We mock services using functions. All in order to test how a certain portion of an application should preform in production. As AngularJS is built upon modularity of code, our unit tests should be no different. How then do we then mock controllers? First off I think it's important to note why I am asking this question in the first place. You might be thinking to yourself well...

Unit testing in AngularJS - Mocking Services and Promises

In Angular everything seems to have a steep learning curve and unit testing an Angular app definitely doesn't escape this paradigm. When I started with TDD and Angular I felt that I was spending twice (maybe more) as much time figuring out just how to test and maybe even more just getting my tests set up correctly. But as Ben Nadel put it in his blog there are ups and downs in the angular learning process - his graph is definitely my experience with Angular. However as I have progressed in learning Angular and unit testing as well, now I...

Ui-Router State Transition Animations & Bootstrap

I was given what I thought was a nearly impossible task by my product owner - create an animation when changing states. I began using ngAnimate and came up with what I thought was a pretty cool solution to his problem - wrong. "This isn't what I had in mind he told me. As I change between panels of a collapse widget I want to change the state and update the URL as well." Me - "Oh boy..." So how else can I animate state transitions using an accordion like approach or in bootstrap terminology - the collapse widget? Back...
pow wow!