Question 1. What Are The New Features Of Angular2?
Angular 2 is written absolutely in Typescript and meets the ECMAScript 6 specification :
Component-Based- Angular 2 is completely factor based totally. Controllers and $scope are not used. They had been changed by way of components and directives.
Directives- The specification for directives is extensively simplified, even though they're nonetheless situation to trade. With the @Directive annotation, a directive can be declared.
Dependency Injection- Because of the progressed dependency injection model in Angular2 there are extra possibilities for issue / item-based totally paintings.
Generics- TypeScript has generics which may be used inside the frontend.
Lambdas with TypeScript- In TypeScript, lambdas are available.
Forms and Validations- Forms and validations are an important thing of frontend improvement. Within Angular 2 the Form Builder and Control Group are described.
Question 2. What Is The Need Of Angular2?
Angular 2 isn't always only a normal upgrade but a very new development. The complete framework is rewritten from the ground. Angular 2 got rid of many such things as $scope, controllers, DDO, jqLite, angular.Module and so on.
It makes use of components for almost the entirety. Imagine that even the complete app is now a issue. Also it takes gain of ES6 / TypeScript syntax. Developing Angular 2 apps in TypeScript has made it even greater effective.
Apart from that, many stuff have developed and re-designed just like the template engine and plenty of extra.
PHP Interview Questions
Question 3. What Is Typescript ?
Question 4. What Is The Need For Typescript In Angular2?
Same can be written using TypeScript as follows-
public call : string = "";
public identity : string = "";
Question 5. What Is Ecmascript ?
Angular JS Interview Questions
Question 6. What Is @ngmodule?
@NgModule is a decorator feature. A decorator characteristic lets in users to mark some thing as Angular 2 element (could be a module or component or something else) and it enables you to offer extra information that determines how this Angular 2 factor can be processed, instantiated and used at the runtime. So, whenever user writes @NgModule, it tells the Angular 2 module, what’s going to be covered and used in and the use of this module.
Question 7. What Is Traceur Compiler ?
Ext JS Tutorial Ext JS Interview Questions
Question eight. What Is Component In Angularjs 2 ?
In Angular, a Component is a unique kind of directive that makes use of a easier configuration that's suitable for a element-based totally software structure.
Question nine. What Is @inputs In Angular 2?
@Input permits you to bypass statistics into your controller and templates thru html and defining custom residences. This permits you to effortlessly reuse components and feature them display exceptional values for every example of the renderer.
Django Interview Questions
Question 10. What Is @outputs In Angular?
Components push out activities the usage of a mixture of an @Output and an EventEmitter. This lets in a easy separation among reusable Components and alertness common sense.
Question 11. What Is Primeng? How Can It Be Used With Angular2?
PrimeNG is a collection of rich UI additives for Angular 2. PrimeNG is a sibling of the popular JavaServer Faces Component Suite, PrimeFaces. All widgets are open source and loose to use underneath Apache License 2.0, a industrial pleasant license. PrimeNG is advanced by means of PrimeTek Informatics, a employer with years of knowledge in growing open supply UI additives. AngularJS makes it viable to apply predefined components for improvement like tables and so forth. This enables builders store time and efforts. Using PrimeNG developers can create first-rate packages very quickly
Java Abstraction Interview Questions
Question 12. What Are Differences Between Components And Directives?
For check in element we use @Component meta-information annotation.
Component is a directive which use shadow DOM to create encapsulate visual conduct known as additives.Components are typically used to create UI widgets.
Component is used to break up the utility into smaller components.
Only one factor may be gift consistent with DOM detail.
@View decorator or templateurl template are obligatory inside the factor.
For sign in directives we use @Directive meta-facts annotation.
Directives is used to feature conduct to an current DOM detail.
Directive is locate to layout re-usable additives.
Many directive may be used in a according to DOM element.
Directive don’t have View.
PHP Interview Questions
Question 13. We Already Use Angular 1, Why Do We Need An Angular 2?
Angular 2 is constructed for velocity :
It has faster preliminary hundreds.
Faster alternate detection.
Progressed rendering times.
Angular 2 is modern-day.
It leverages net component technologies for constructing reusable consumer interface widgets.
It supports each Greenfield and Legacy browsers, Edge, Chrome, Firefox and Internet Explorer again to IE9.
It has fewer integrated directives to analyze easier binding.
Enhances our productiveness to improve our daily workflow.
Angular Material Tutorial
Question 14. What Is An Angular 2 Component?
Each issue is made out of a template, that's the HTML for the consumer interface. Add to that a category for the code associated with a view. The class includes the homes and techniques, which carry out movements for the view,A thing additionally has metadata, which presents additional data approximately the thing to Angular.
Question 15. What Is The Languages That You Can Use To Build Angular2 Application?
ECMAScript, or ES.
ES 3 is supported through older browsers.
ES 5 is the version presently supported through maximum contemporary browsers.
The ES 6 specification was lately permitted and renamed ES 2015(Most browsers do not yet support ES 2015).
Angular Material Interview Questions
Question sixteen. How Can We Setting Up Our Development Environment For Angular 2?
Setting up our improvement surroundings for Angular 2 calls for two fundamental steps:
Install npm, or node package supervisor.
Set up the Angular 2 application.
Question 17. What Is Npm?
Phonegap Interview Questions
Question 18. How Can We Setting Up Angular 2 Application?
Create an utility folder.
Create the tsconfig document(To configure the TypeScript compiler).
Create the bundle.Json document(To define the libraries and scripts we want).
Create the typings.Json document(That specifies a missing TypeScript type definition report).
Install the libraries and typing documents.
Create the host Web web page.(Normally index.Html).
Create the principle.Ts document(To bootstrap the Angular software with the foundation factor).
Angular JS Interview Questions
Question 19. What Are The Security Threats Should We Be Aware Of In Angular 2 Application?
Just like every other consumer aspect or net utility, angular 2 software need to additionally follow some of the primary hints to mitigate the security dangers. Some of them are:
Avoid the usage of/injecting dynamic Html content material for your factor.
If the usage of outside Html, that is coming from database or somewhere out of doors the software, sanitize it.
Try now not to put outside urls in the utility unless it is relied on. Avoid url re-path except it's far depended on.
Consider the use of AOT compilation or offline compilation.
Try to save you XSRF attack by using proscribing the api and use of the app for acknowledged or comfy surroundings/browsers.
Question 20. What Are The Advantages Of Using Angular 2 Over Angular 1?
Angular 2 is a platform now not handiest a language:
Better Speed and Performance: No $Scope in Angular 2, AOT
Simpler Dependency Injection
Modular, move platform
Benefits of ES6 and Typescript.
Flexible Routing with Lazy Loading Features
Easier to Learn
MongoDB Interview Questions
Question 21. How Routing Works In Angular 2.?
Routing is a mechanism which enables user to navigate between perspectives/additives. Angular 2 simplifies the routing and offer flexibility to configure and define at module stage (Lazy loading).
The angular utility has unmarried example of the Router provider and every time URL adjustments, corresponding Route is matched from the routing configuration array. On a success in shape, it applies redirects and the router builds a tree of ActivatedRoute gadgets and carries the modern-day country of the router. Before redirection, the router will take a look at whether new nation is permitted by means of walking guards (CanActivate). Route Guards is without a doubt an interface technique that router runs to check the path authorization. After shield runs, it will remedy the path information and prompt the router country by means of instantiation the required components into <router-outlet> </router-outlet>.
Question 22. What Are Event Emitters And How It Works In Angular 2?
Angular 2 doesn’t have bi-directional digest cycle, not like angular 1. In angular 2, any trade happened in the issue constantly gets propagated from the modern-day factor to all its children in hierarchy. If the trade from one factor wishes to be reflected to any of its determine element in hierarchy, we will emit the occasion through the usage of Event Emitter api.
In quick, EventEmitter is magnificence described in @angular/center module which may be utilized by components and directives to emit custom activities.
@output() somethingChanged = new EventEmitter();
We use somethingChanged.Emit(value) technique to emit the event. This is normally performed in setter while the price is being changed within the class.
This occasion emit may be subscribed through any component of the module by way of using subscribe technique.
MyObj.SomethingChanged.Subscribe(val) => this.MyLocalMethod(val));
Question 23. What Is The Use Of Codelyzer In Angular 2 Application.?
All company programs follows a fixed of coding conventions and hints to keep code in higher way. Codelyzer is an open source device to run and check whether the pre-described coding guidelines has been observed or now not. Codelyzer does only static code analysis for angular and typescript challenge.
Codelyzer runs on top of tslint and its coding conventions are generally defined in tslint.Json record. Codelyzer can be run thru angular cli or npm immediately. Editors like Visual Studio Code and Atom also helps codelyzer simply through doing a basic settings.
To set up the codelyzer in Visual Studio code, we can go to File -> Preferences -> User Settings and add the route for tslint regulations.
Hide Copy Code
To run from cli: ng lint.
To run from npm: npm run lint
Angular five Interview Questions
Question 24. How Would You Optimize The Angular 2 Application For Better Performance?
ell, optimization relies upon on the kind and length of application and plenty of different factors. But in standard, I could recollect the subsequent points while optimizing the angular 2 app:
Consider AOT compilation.
Make positive the utility is bundled, uglified, and tree shaking is done.
Make certain the software doesn’t have un-essential import statements.
Make sure that any 3rd birthday party library, which isn't used, is removed from the software.
Have all dependencies and dev-dependencies are clearly separated.
I would recollect lazy loading in place of fully bundled app if the app size is extra.
Ext JS Interview Questions
Question 25. How Would You Define Custom Typings To Avoid Editor Warnings?
Well, in maximum of the instances, the 3rd party library comes with its very own .D.Ts document for its kind definition. In some cases, we want to extend the prevailing kind by providing some more houses to it or if we need to outline extra sorts to avoid Typescript warning.
If we want to extend the sort definition for outside library, as a very good practice, we need to not touch the node_modules or existing typings folder. We can create a new folder, say “custom-typings” and preserve all custom designed type definition in that.
For the ones cases, we will outline or make bigger the sorts by growing our own “.D.Ts” document.
Question 26. What Is Shadow Dom? How Is It Helping Angular 2 To Perform Better?
Since shadow DOM are static in nature, it’s a good candidate to be cached as it isn't available to developer. The cached DOM might be rendered faster within the browser offering higher overall performance. Moreover, shadow DOM may be controlled relatively well whilst detecting the change in angular 2 utility and re-paint of view may be managed successfully.
Angular four Interview Questions
Question 27. What Is Aot Compilation?
Django Interview Questions
Question 28. What Are The Advantages And Disadvantages Of Aot Compilation?
Faster download: Since the app is already compiled, many of the angular compiler related libraries aren't required to be bundled, the app package length get reduced. So, the app may be downloaded quicker.
Lesser No. Of Http Requests: If the app isn't always bundled to support lazy loading (or some thing motives), for every related html and css, there may be a separate request goes to the server. The pre-compiled application in-traces all templates and styles with additives, so the range of Http requests to the server might be lesser.
Faster Rendering: If the app isn't always AOT compiled, the compilation method takes place within the browser as soon as the utility is absolutely loaded. This has a wait time for all necessary element to be downloaded, after which the time taken by the compiler to compile the app. With AOT compilation, this is optimized.
Detect mistakes at construct time: Since compilation takes place in advance, many compile time error may be detected, supplying a better diploma of stability of utility.
Works handiest with HTML and CSS, different document kinds want a previous build step.
No watch mode yet, need to be completed manually (bin/ngc-watch.Js) and compiles all the documents.
Need to keep AOT version of bootstrap document (won't be required at the same time as using equipment like cli).
Needs cleanup step before compiling.
Question 29. What Are The Core Differences Between Observables And Promises?
Promises vs Observables :
returns a unmarried cost.
Now not cancellable.
works with more than one values through the years.
Helps map, filter, reduce and comparable operators.
Proposed feature for ES 2016.
Use Reactive Extensions (RxJS).
An array whose gadgets arrive asynchronously over time.
Angular 6 Interview Questions
Question 30. Difference Between Constructor And Ngoninit?
Differences - Constructor Vs. NgOnInit
Angular 2 Constructors:-
The constructor is a default method runs while factor is being built.
The constructor is a typescript function and it is used handiest for a class instantiations and nothing to do with Angular 2.
The constructor referred to as first time before the ngOnInit().
Angular 2 ngOnInit:-
The ngOnInit occasion is an Angular 2 existence-cycle event approach that is referred to as after the primary ngOnChanges and the ngOnInit approach is locate to parameters described with @Input otherwise the constructor is OK.
The ngOnInit is referred to as after the constructor and ngOnInit is known as after the first ngOnChanges.
The ngOnChanges is known as whilst an enter or output binding cost changes.