Angular Questions Flashcards
How do Angular applications work?
Angular is a platform and framework for building single-page client applications using HTML and TypeScript. Angular is written in TypeScript.
What are the differences between AngularJS and Angular?
Angular uses TypeScript and has components as its main building blocks. It is component-based, whereas AngularJS uses directives. Angular’s operation employs a hierarchy of components, while AngularJS has directives that allow code reusability. So, The AngularJS framework provides reusable components for its users.
What are the advantages of AOT compilations?
The Angular ahead-of-time (AOT) compiler converts your Angular HTML and TypeScript code into efficient JavaScript code during the build phase before the browser downloads and runs that code. Compiling your application during the build process provides a faster rendering in the browser. AOT compilation is particularly suited for cloud applications.
What is string interpolation in Angular?
In Angular, String interpolation is used to display dynamic data on HTML template (at user end). It facilitates you to make changes on component. ts file and fetch data from there to HTML template (component. html file). It uses the template expression in double curly braces to display the data from the component to the view.
Explain Promises in Angular.
A promise in angular is a JavaScript object which produces a value after an async operation is executed successfully. If the operation does not execute successfully, then it generates an error. A promise in angular is a class-based object, it is created using the new keyword and its constructor function.
What is the difference between promise and Observable?
Both observables and promises help us work with asynchronous functionality in JavaScript. Promises deal with one asynchronous event at a time, while observables handle a sequence of asynchronous events over a period of time. Emit multiple values over a period of time. Emit a single value at a time.