Unit testing an AngularJS factory method returning a promise
In this article we're going to talk about how to write a Jasmine unit test to validate the values of a promise returned from an Angular factory. It's not as complicated as it sounds!
In this article we're going to talk about how to write a Jasmine unit test to validate the values of a promise returned from an Angular factory. It's not as complicated as it sounds!
As mentioned in an earlier post AngularJS has some services that use Promises (like $http
) and there are other ways that you can utilise promises within your AngularJS application.
AngularJS can utilise promises in its routing via a property called 'resolved'. The resolve property guarantees that a particular route is going to be loaded only when a promise is successfully fulfilled (resolved).
Tamas Piros | 1 May 2016 | AngularJS
In this article we take a deep look at how to work with the event emitters and listeners in AngularJS, covering $broadcast
, $emit
, $on
and the importance of scope hierarchy.
Simon Holmes | 27 January 2016 | AngularJS
The bane of my life has always been validating forms. Checking for X number of characters or numbers, making sure fields are all filled out, adding regular expressions to these checks, applying if and switch statements to these checks was never something I enjoyed doing. Maybe the developers behind Angular shared similar sentiments as they have come up with quite a few number of built in validation features for working with forms in Angular.
Tamas Piros | 19 January 2016 | AngularJS
People who are new to AngularJS often ask this question - what is the difference between ng-show / ng-hide and ng-if. Although seemingly these directives work in the same way there is a significant and important difference between them.
Tamas Piros | 18 January 2016 | AngularJS
In this article we'll put together a very basic Ionic mobile application and also discuss how you can debug your application.
One of the key features of AngularJS is ng-repeat
which is a "directive that instantiates a template once per item from a collection." The key in this sentence that it can create a template for items in a collection - collections being arrays or objects. But how can you iterate through a simple integer value? Let's have a look at this now.
Tamas Piros | 30 July 2015 | AngularJS, Tip of the day
A quick look at how to use $watch
in an Angular controller when you're using the controllerAs syntax.
Simon Holmes | 8 March 2015 | AngularJS, Tip of the day