Skip to content

Instantly share code, notes, and snippets.

@dwivediamit
Last active April 25, 2022 07:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dwivediamit/7022de2eb8b276c4be114ffe6b7a0158 to your computer and use it in GitHub Desktop.
Save dwivediamit/7022de2eb8b276c4be114ffe6b7a0158 to your computer and use it in GitHub Desktop.

What is Lazy loading in angular

Lazy loading is most useful concept of angular routing and bring down the size of large file. This is done by Lazy loading the files that is required load occasinally. Angular 8 comes with support dynamic imports in our routing configuration.

Difference between Promise and Observable in angular

Promise:
Return single value
Not cancellable
More readable code with try/catch and async/await
Observable:
Work with multiple value over the time
Cancellable
Support map, filter, reduce and similar operators use RxJs (Reactive extension).

What is Observable in Angular

Angular Observable use as an interface to handle a variety of common asynchronous operations such as send observable data from child to parent component by defining custom events, handle AJAX or HTTP requests and responses, listen and respond user input in Angular Router and Forms.

What are the utility function in RxJs

The RxJs provides below utility functions for creating and working with Observables.
1. Converting
2. Iterating
3. Maping
4. Filtering
5. Composing

What is subscribing in angular

Subscribe() is a method in Angular that connects the observer to observable events. Whenever any change is made in these observable, a code is executed and observes the results or changes using the subscribe method. Subscribe() is a method from the rxjs library, used internally by Angular.

What is Wildcard Route in angular

A Wildcard route has a path consisting of two asterisks (). It matches every URL, the router will select this route if it can't match a route earlier in the configuration. A Wildcard Route can navigate to a custom component or can redirect to an existing route. Example: { path: '', component: PageNotFound }

What is the use of Codelyzer in angular.

CodeLyzer is an open-source tool in angular whose main function is to check for errors in code which is not following pre-defined guidelines. It runs in tslist.json file and it checks errors only for static code while coading.

Difference between Javascript and Typescript

Javascript is developed with ES5 standards.
Typescript is developed with ES6 standards. 
Typescript is a superset of javascript.

Data Binding in Angular.

Data binding is a process that creates a connection between the application’s UI and the data. When the data changes its value, the UI elements that are bound to the data will also change.

There mainly two types of data binding in angular

One way data binding

One way data binding is a change in the state affects the view from component to view template or change in the view affects the state from view template to component.

Two-way data binding

Two-way data binding is a change from the view can also change the model and similarly changes in the model can also change in the view from component to view template, and also from view template to the component.

There are several ways to bind data between components and view in Angular.
1. Interpolation
2. Property binding
3. Class binding
4. Style binding
5. Attribute binding
6. Event binding
7. Two-way binding

How angular works

The flow of angular works... Main.ts > AppModule.ts > App.component.ts It serves the content available in template files.

What is single page application

In angular index.html is the only file that is served from server, that is the reason angular is called single page application. all the other files served by angular.

Difference between synchronous and asynchronous communication

The key difference between synchronous and asynchronous communication is synchronous communications are scheduled, real-time interactions by phone, video, or in-person. Asynchronous communication happens on your own time and doesn't need scheduling.

Async-Await

When an async function is called, it returns a Promise. When the async function returns a value, the Promise will be resolved with the returned value. When the async function throws an exception or some value, the Promise will be rejected with the thrown value.

An async function can contain an await expression, that pauses the execution of the async function and waits for the past Promise’s resolution, and then resumes the async function’s execution and returns the resolved value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment