Simple example using promise in AngularJS