Posts

Showing posts with the label angular 2

Understanding TypeScript Interfaces

Image
Content Source: Angularjs Development Company An interface is a programming feature that helps to define the expected structure of an object allowing that to serve as a contract of sorts for the class where it is implemented. That helps explain the concept but how does this actually translate into working with real world code? Let’s say for example we have the following method: 1 2 3 4 public requestSpecificArea(lat : number, lng : number) : Observable {   return this.http.get(this._api + `locate-neighbourhood?q=${lat},${lng}`); } As you can gather from the code we’re using Angular’s HttpClient class to query a remote API which returns data as an observable that we can subsequently subscribe to. Continue reading

React Context API  –  A Replacement for Redux?

Image
Content Source: Angularjs Development Company With React is urging us to migrate to the new Context API. Context provides a way to pass data through the component tree without having to pass props down manually at every level. In React, data is often passed from a parent to its child component as a prop. This method has worked well in the past, but is not suitable for every kind of data. It will make things difficult later when moving components around. props even get passed down to child components which aren’t using the data. Is Context API a new thing? The truth is that Context has been a part of React for a really long time. Remember the <Provider> tag that we used earlier in the Redux app? It is actually a part of the older React Context API. React Context API is even used by libraries such as react-redux, MobX-react, react-router, and glamorous. So why is React Context API making such a big noise now? React used to discourage developers...

Building a Reactive Application with Ngrx and Angular 2

Image
We talk a lot about reactive programming in the Angular realm. Reactive programming and Angular 2 seem to go hand in hand. However, for anyone not familiar with both technologies, it can be quite a daunting task to figure out what it is all about. What Is Reactive Programming? Reactive programming is a term that you hear a lot these days, but what does it really mean? Reactive programming is a way applications handle events and data flow in your applications. In reactive programming, you design your components and other pieces of your software in order to react to those changes instead of asking for changes. This can be a great shift. A great tool for reactive programming, as you might know, is RxJS. By providing observables and a lot of operators to transform incoming data, this library will help you handle events in your application. In fact, with observables, you can see event as a stream of events and not a one-time event. This allows you to combine them, for example,...