Currently browsing: AngularJS

Adventures with AngularJS 1.3

The new AngularJS (specifically v1.3) offers many new features and under-the-hood improvements. For details about this release you should check out the changelog. There are a few breaking changes and I want to discuss one in particular that gave me headaches. Let’s say you have a directive such as this one: Your unit test for […]

Continue reading →

Best practice

If you did any development in AngularJS, I’m sure you know about the $watch function. On every digest cycle, Angular will evaluate an expression to see if its value changes. If it did, it will fire all the listeners on that particular watch. Of course, this can be very expensive as your app grows and […]

Continue reading →

Protractor testing

I’ve been working a lot with protractor recently. And even though there are still some issues with phantomjs, it is still pretty awesome. It integrates seamlessly with Jasmine and Cucumber, so that’s a bonus. To start using protractor you can follow the official documentation here. One very cool feature I like is multiCapabilities. As E2E […]

Continue reading →

Quick tip

If you are using protractor to test your webapps, then you are inevitably using Promises. Sometimes you might want to create an immediately resolved/rejected promise. Typically you would write this: But you can just as easily write the same thing like this: Much easier!

Continue reading →

Lazy loading components in AngularJS

There is no need to load everything at first load for an AngularJS application. It only delays initialization, increases the web application’s size and hurts performance. It would be so much simpler if you could just load components when they are used and not sooner. (FYI, a component is one of AngularJS directives/filters/services and even […]

Continue reading →

Setting environment variables in Angular using Grunt

I’ve come across an interesting problem recently. While developing an angular app, I needed to switch from a live web service to a local web service during the development. And this got me thinking: “This is the perfect situation where different environments would be incredibly useful”. Instead of manually changing the endpoints of the web […]

Continue reading →