UI Developer / Lead / Architect Interview Question and Answers – Part 2

UI Developer / Lead / Architect Interview Question and Answers – Part 2

Type of components in Angular ? 

There are two types of components in Angular 


– Declarative components  

these components are  which are included in the template


– Entry components 

Any component that Angular loads imperatively and you’re not referencing it in the template. 



what is entry components in modules  ?


An entry component is any component that Angular loads imperatively, (which means you’re not referencing it in the template), by type. 

You specify an entry component by bootstrapping it in an NgModule, or including it in a routing definition. 


There are two main kinds of entry components:


The bootstrapped root component.

A component you specify in a route definition.


Explain the process to do for popup in Angular material design ?   

The Angular Material library offers support for displaying modal dialogs in Material Design. 

To enable Angular Material Dialogs in your Angular application you need to import MdDialogModule in your main application module.

Next, make sure to also add MdDialogModule to the imports array of @NgModule

Make use of the MdDialog service which is part of MdDialogModule in our components

create a new component using cmd “ng g component DialogDemo”

which creates 4 files  html / css / ts / spec.ts  as below 


src/app/dialog-demo/dialog-demo.component.css

src/app/dialog-demo/dialog-demo.component.html

src/app/dialog-demo/dialog-demo.component.spec.ts

src/app/dialog-demo/dialog-demo.component.ts



In dialog-demo.component.html file add html code for modal popup display code using MdDialog, MdButton and MdCard elements and directives. 

import {MdCardModule} from ‘@angular/material’;

import {MdButtonModule} from ‘@angular/material’;

import {MdDialogModule} from ‘@angular/material’;


And add the types to the imports array also :

imports: [

BrowserModule,

BrowserAnimationsModule,

MdCardModule,

MdButtonModule,

MdDialogModule

  ],

  

  

add the component selector to the markup code of our main application component in file app.component.html. 

<app-dialog-demo></app-dialog-demo>

Now you can customize the code based on the actions/events/data sharing etc.. in the modal (Dialog) popup component/services in ts files. 



what is the criteria to choose on JS frameworks ? 

There are many criteria when it comes to choosing a JS framework like 

Functionality , Usability, Reliability, Efficiency, Maintainability and Portability 

and also finalize based on the 

Project requirements suitability 

Browser Support {typically with Safari on the Mac} 

Strength of development team supporting the framework.

Maturity of the framework

Frequency of public updates and releases.

Documentation quality.

Existence of an active community.

Benchmark tests on performance aspects

Extensibility of the framework with Plugin support 

API Style Support 

Commericial Support availablity 

and functionalitywise support like 


DOM navigation/manipulation

Basic UI components support

Advanced UI widget library

Themes and skinning support

Validations support

Ease of server interaction

Multiple data exchange formats support 

how to trigger LazyLoading feature in AngularJS ?

we need lazy loading to improve the performance of loading time of the application. 

Instead of loading all components at first time , in angular we can split this into children and load it whenever required.

Lazy Loading is load only what we need to use when first starting up the application. 

If user navigate to a new page, then the component for that page will load immediately.


Lazy loading is performed by allowing the router config to provide the module to load on route execution. 

To utilize lazy loading you must split your code into modules.

In the app.router.ts you will have the special router called loadChildren, this is used for lazy loading module 

and it accepts value as a string. 

The path of the loadChildren is based on src directory, you need to provide the full path of your feature module 

and put the ‘#’ sign then your export module class name.

Finally, we need to import the app.router.ts that is root router of the application to the app.module.ts.


how to do State Management in AngularJS  ? 

State Management OR Managing state means need to coordinate multiple backends, web workers, and UI components, all of which update the state concurrently. 

Patterns like Redux and Flux are designed to address this problem by making this coordination more explicit.

A typical web application has the following six types of state:


Server state

Persistent state

The URL and router state

Client state

Transient client state

Local UI state


Backend manages the server state, persistent state (the talks) and the client state (the filters).

The router manages the URL and the router state.

WatchService manages the transient client state (watched talks).

The individual components manage the local UI state.


and maintaining / synchronizing these states across the application using custom observers OR usnig tools like Redux. 


what is content in angular ?

Transclusion in AngularJS OR Content Projection in Angular is a way to let you define a fixed view template, and 

at the same time allow you to define a slot for dynamic content by using <ng-content> tag.

and using the type of selector like Attribute, HTML tag, or CSS class etc.. you can load the dynamic content in the ng-content directive section. 

Whenever some libraries conflict issues are coming , how do you solve ?

You can avoid the conflicts with other libraries using namespaces OR Alias like jQuery noConflict method. 

OR 

if libraries are managed using packages.json than using peerDependencies package attribute you can manage multiple versions of files.


Difference between routing and templating ? 

Routing -> To navigate to different pages in the application with no page reloading we use Angular Routing using ngRoute module.

The ngRoute module routes your application to different pages without reloading the entire application.


Templating -> templating allows you to create one master page for the structure and then just replace pieces of the page with different content based on the url.


AngularUI Router -> The UI-Router is a routing framework for AngularJS provides a different approach than ngRoute in that it changes your application views based on state of the application and not just the route URL. 



Difference between unidirectional data binding and bidirectional data binding ? 

One way binding is bind the data from model to view. 

Where as two way binding is bind the data from model to view and view to model. 

Data flows from the Scope/Controller to the View and from the View to the scope/controller). 

‘ng-model’ is an angular directive used for achieving two-way data binding.



Difference between responsive and adaptive design ? 

Responsive sites and adaptive sites are the same in that they both change appearance based on the browser environment , size, device etc…


Responsive Web Design makes your web page look good on all devices (desktops, tablets, and phones). 

Responsive Web Design is about using HTML and CSS to resize, hide, shrink, enlarge, or move the content to make it look good on any screen. 

Fluid grids, flexible images, and media queries are the three technical ingredients for responsive web design.


Adaptive design detects the device and other features and then

provides the appropriate feature and layout based on a predefined set of viewport sizes and other characteristics 



Difference b/w Javascript vs ES5 or ES6 ? 

scripting language is a programming language designed specifically for acting on an existing entity or system. 

ECMA means European Computer Manufacturer’s Association  ECMAScript (ES)  –>  Is the specification defined in ECMA-262 for creating a general purpose scripting language. 

ECMAScript provides the rules, details, and guidelines that a scripting language must observe to be considered ECMAScript compliant.


JavaScript (JS)  –> A general purpose scripting language that conforms to the ECMAScript specification. 

JavaScript mostly implements the ECMAScript specification as described in ECMA-262. 


A JavaScript engine –> A program or interpreter that understands and executes JavaScript code. 

JavaScript engines are commonly found in web browsers, including V8 in Chrome, SpiderMonkey in Firefox, and Chakra in Edge. 


ECMAScript 5 –> 

It is the fifth edition of the ECMA-262 standard, and major features of the ECMAScript specification. 


ECMAScript 6  –> 

It is the sixth edition of the ECMA-262 standard, and features major changes and improvements to the ECMAScript specification.


Babel

A transpiler that can convert ES6 code to ES5 code.



Which is First ? Chicken or  Egg — ECMAScript or JavaScript 

A confusing bit of history is that JavaScript was created in 1996. It was then submitted to Ecma International in 1997 for standardization, which resulted in ECMAScript. At the same time, because JavaScript conformed to the ECMAScript specification, JavaScript is an example of an ECMAScript implementation.

ECMAScript is based on JavaScript, and JavaScript is based on ECMAScript.

To read more on this topic, here is the best article resource : https://www.toptal.com/angular/angular-components-overview-101

Leave a Reply

Your email address will not be published. Required fields are marked *

thirteen − 12 =