Differences between Promise and Observable in Angular

Code examples and video tutorials about Promise and Observable in Angular.js
05 September 2017   996

Promise

Promise handles a single event when an async operation completes or fails.

Note: There are Promise libraries out there that support cancellation, but ES6 Promise doesn't so far.

Observable

An Observable is like a Stream (in many languages) and allows to pass zero or more events where the callback is called for each event.

Often Observable is preferred over Promise because it provides the features of Promise and more. With Observable it doesn't matter if you want to handle 0, 1, or multiple events. You can utilize the same API in each case.

Observable also has the advantage over Promise to be cancelable. If the result of an HTTP request to a server or some other expensive async operation isn't needed anymore, the Subscription of an Observable allows to cancel the subscription, while a Promise will eventually call the success or failed callback even when you don't need the notification or the result it provides anymore.

Observable provides operators like mapforEachreduce, ... similar to an array

There are also powerful operators like retry(), or replay().

How to command robots with Angular?

Sebastian Witalec, Technical Evangelist for Progress/Telerik talks about NativeScript framework
17 October 2017   294

NativeScript is a free and open source JavaScript framework for building native iOS and Android apps. Add to that Angular with TypeScript and you will get a truly amazing combination. Then chip in some drones and robots with a BLE API and you are ready to rock.

But I know what you’re thinking: another way of building apps? What makes NativeScript special? Here are a few cool things:

  • Direct access to native APIs—no plugins required. Want to create a file on Android? Run new java.io.File()—in JavaScript!
  • Completely native performance through the use of a JavaScript bridge natively available on all three mobile platforms.
  • Cross-platform libraries for common use cases. Need to call a JSON API? Run http.getJSON
  • Style native apps using CSS. Yep, that’s actually a thing.

Speaker is Sebastian Witalec. He is a Technical Evangelist for Progress/Telerik with over 8 years of experience in software engineering and architecture. Sebastian has passion for all types of technologies. However in the last few years his focus shifted towards cross platform Mobile development where he gained experience with Apache Cordova and NativeScript. He is always happy to learn about the new stuff and to pass the knowledge as far as his voice (or the wire) can take him. Sebastian is based in London, UK actively working with various Dev communities in the area. When not acting techie he is a massive football fan/player (probably bigger at heart than skills).