Skip to main content

Posts

Showing posts from January, 2020

Implement a Service From Angular (Http Observables and Rxjs)

What is a Service in Angular? Angular services are singleton objects which get instantiated only once during the lifetime of an application. They contain methods that maintain data throughout the life of an application, i.e. data does not get refreshed and is available all the time. The main objective of a service is to organize and share business logic, models, or data and functions with different components of an Angular application. What is Rxjs ? It is a Reactive Extensions for JavaScript. Also external library to work with Observables.  Implementation So now we are going to create a service using  Http Observables and Rxjs . Basically there are four main steps to do that. 1. Http get request from service. 2. Receive the observable and cast it into an array. 3. Subscribe to the observable component. Now I'm going to implement a service for fetching data from server to our web page.  First Step 1.1  Import HttpClientModule for app.module.ts

What is Angular?

What is Angular? Angular is a TypeScript-based open-source web application framework led by the Angular Team at Google. Angular is a complete rewrite from the same team that built AngularJS. For now it's stable release is 8.2.14. What is the difference between Angular and AngularJs? Basically Angular is based on TypeScript. AngularJs  is based on JavaScript. What is TypeScript? TypeScript is an open-source programming language developed and maintained by Microsoft. It is a strict syntactical superset of JavaScript, and adds optional static typing to the language. TypeScript is designed for development of large applications and transcompiles to JavaScript. What is JavaScript? JavaScript, often abbreviated as JS, is a high-level, just-in-time compiled, multi-paradigm programming language that conforms to the ECMAScript specification. JavaScript has curly-bracket syntax, dynamic typing, prototype-based object-orientation, and first-class functions. Why we need to l