Thursday, January 17, 2019

20+ Frequently Asked AngularJS Interview Questions and Answers

20+ Frequently Asked AngularJS Interview Questions and Answers

 

AngularJS can be a demanding technology, prompting a salary scope of anything from $60/hour for a freelance developer to $70,000/year for a Front End Developer/Engineer in an organization. Since this certification is a requirement for a large percentage of web-developer job postings, you can assume that there is never a lack of qualified candidates.
In every interview, you will have to contend with fierce competition. To perform well and get your dream job, you have to prepare in advance. To help you, we’ve outlined 20 frequently asked AngularJS interview questions and the kind of answers your interviewer is likely looking for.
1. In 30 seconds, define AngularJS.
AngularJS is an open-source JavaScript framework designed for creating dynamic single web page applications with fewer lines of code.
2. Mention some advantages of using AngularJS framework.
Some of the key advantages of using AngularJS framework include:
  • It provides a great “desktop-like” experience to the end user.
  • By separating DOM manipulation from app logic, it makes code modular and easy to test.
  • It supports two-way data binding.
3. What is the main thing that you would need to change if you were migrating from AngularJS 1.4 to AngularJS 1.5? 
To adapt to the new AngularJS 1.5 components, you would need to change .directive to .component
4. Is AngularJS compatible with all browsers? 
Yes.
5. What are the key features of AngularJS?




AngularJS, the self-proclaimed “superheroic JavaScript MVW framework,” has been around since 2009 and it remains one of the most popular web development frameworks the world over. According to Indeed.com, the demand for developers has been on the rise in recent months and this trend is expected to continue.
AngularJS can be a demanding technology, prompting a salary scope of anything from $60/hour for a freelance developer to $70,000/year for a Front End Developer/Engineer in an organization. Since this certification is a requirement for a large percentage of web-developer job postings, you can assume that there is never a lack of qualified candidates.
In every interview, you will have to contend with fierce competition. To perform well and get your dream job, you have to prepare in advance. To help you, we’ve outlined 20 frequently asked AngularJS interview questions and the kind of answers your interviewer is likely looking for.
1. In 30 seconds, define AngularJS.
AngularJS is an open-source JavaScript framework designed for creating dynamic single web page applications with fewer lines of code.
2. Mention some advantages of using AngularJS framework.
Some of the key advantages of using AngularJS framework include:
  • It provides a great “desktop-like” experience to the end user.
  • By freeing the developer from having to register callbacks manually or write repetitive low-level DOM manipulation tasks, it saves months of development.
  • By separating DOM manipulation from app logic, it makes code modular and easy to test.
  • It supports two-way data binding.
3. What is the main thing that you would need to change if you were migrating from AngularJS 1.4 to AngularJS 1.5? 
To adapt to the new AngularJS 1.5 components, you would need to change .directive to .component
4. Is AngularJS compatible with all browsers? 
Yes.
5. What are the key features of AngularJS?
  • Scope
  • Controller
  • Model
  • View
  • Services
  • Data Binding
  • Directives
  • Filters
  • Testable
6. Define scope in AngularJS.
Scope is a special JavaScript object that plays the role of joining the controller (JavaScript) with the views (HTML). The controller sets properties on the scope and the view binds to them.
7. Explain the concept of scope hierarchy.
Each AngularJS application has only one root scope. Child controllers, however, create a scope for each view. When the new scopes are created, they are added to their parent root scope as child scopes. This creates a hierarchical structure when they are attached.
8. What is data binding in AngularJS and What is the difference between one-way and two-way binding?
Data binding is the automatic attunement of data between the view and model components. AngularJS uses two-way data binding. In one-way binding, the scope variable in the html is set to the first value that its model is assigned to.
In two-way binding, the scope variable changes its value every time its model binds to a different value.
9. What are directives? 
Directives are special markers on a DOM element that tell the html compiler to attach a specified behavior to the DOM element. Directives start with ng-prefix. Some of the built-in directives include ngClass, ngApp, ngRepeat, ngModel, ngBind and ngInit
10. List the different types of directives.
There are four types of directives:
  • Comment directives
  • CSS class directives
  • Attribute directives
  • Element directives
11. In what ways can you use a directive? 
You can use a directive as an element, attribute or class name. To define the way your directive will be used, you need to set the restrict option in the directive declaration. The restrict option can be set to:
‘A’ - Only matches attribute name
‘C’ - Only matches class name
‘E’ – Only matches element name
You can combine these restrictions to produce needed results.
12. Explain what a digest cycle is in AngularJS?
During every digest cycle, all new scope model values are compared against the previous values. This is called dirty checking. If change is detected, watches set on the new model are fired and another digest cycle executes. This goes on until all models are stable.
The digest cycle is triggered automatically but it can be called manually using “.$apply()”.
13. Which are the common ways of communication between modules of your application, using core AngularJS functionality?
The common ways of communication include:
  • Using events
  • Using services
  • By assigning models on $rootScope
  • Directly between controllers using ControllerAs and other forms of inheritance
  • Directly between controllers using $parent, $$childHead, $$nextSibling
14. Explain what the link function is and how it differs from compile.
The link function combines the directives with a scope to produce a live view.
The link function is responsible for instance DOM manipulation and for registering DOM listeners.
The compile function is responsible for template DOM manipulation as well as the collection of all the directives.
15. Explain e2e testing of AngularJS applications.
End-to-end (e2e) testing involves testing an application from start to finish to determine whether all the components are working properly. It catches issues within an application related to integration and flow.
16. What is dependency injection?
Dependency injection is the process where the dependent objects are injected rather than being created by the consumer.
17. What are the benefits of dependency injection?
Dependency injection has two major benefits: Testing and decoupling.
18. What is Single Page Application (SPA)? 
SPA is the concept whereby pages are loaded from the server not by doing post backs, rather by creating a single shell page or master page and loading the web pages into the master page.
19. How can SPA be implemented in AngularJS?
SPA can be implemented with Angular by using Angular routes
20. How can digest cycle time be decreased?
Digest cycle time can be decreased by decreasing the number of watchers. To do this you can:
  • Use web worker
  • Work in batches
  • Cache DOM
  • Remove unnecessary watchers
  • Use one-time Angular binding

Conclusion

Now that you’ve read all the AngularJS interview questions and answers above, you are a step closer to passing your interview and getting your dream job.
If you feel that you need to refresh your knowledge on some concepts and master front-end web development with Angular, consider taking  Angular Certification training course. It’s affordable and

Angular 6 Interview Questions

Angular 6 Interview Questions

#1 Question

List some new features comes with Angular6

Latest Key features of Angular 6
  • Added support for creating Custom Elements based on Angular Components.
  • Animations: expose element and params within transition matchers.
  • Bazel: change ng_package rule to APF v6
  • singleline, multiline and jsdoc comments are now supported
  • compiler-cli : add resource inlining to ngc
  • support for TypeScript 2.7
  • Require node 8 as runtime engine

#2 Question

Explain Ivy Renderer in Angular?

#3 Question

What is Bazel and Closure Compiler in Angular6?

#4 Question

Explain Service Worker in reference to Angular JS

#5 Question

Write command to generate a component in specific module in Angular cli?

You can generate a component in specific module in AngularJs by running below commnad on CLI.
ng g component component_name --module=module_name

#6 Question

How to generate a module in Angular?

In order to generate a module in Angular, cd to the current project directory and below command.
ng g module module_name

#7 Question

Explain Zone in Angular?

Zones are a kind of performance setting that empowers us to catch into our anachronistic tasks.
Zones in angular APIs increase the performance by executing our code exterior to the angular zone. It helps in preventing Angular from the governing unwanted alter detection assignments.

#8 Question

How to update or upgrade angular cli version

In order to upgrade angular-cli package that was installed globally in your system, you need to run following commands
npm uninstall -g angular-cli
npm cache clean or npm cache verify (if npm > 5)
npm install -g @angular/cli@latest
Instead of upgrading global version of angular-cli you can also upgrade the local version for specific project y running following commands:
rm -rf node_modules
npm uninstall --save-dev angular-cli
npm install --save-dev @angular/cli@latest
npm install

#9 Question

List some Inbuilt Pipes available in Angular

Below are the list of few Pipes available in Angular Js
  • DatePipe
  • CurrencyPipe
  • AsyncPipe
  • DecimalPipe
  • TitleCasePipe
  • JsonPipe
  • SlicePipe
  • PercentPipe
  • UpperCasePipe
  • LowerCasePipe

 

AngularJS Interview Questions

AngularJS Interview Questions

 

#1 Question

What is Angular JS?

AngularJS is a JavaScript framework that is used for making rich, extensible web applications. It runs on plain JavaScript and HTML, so you don’t need any other dependencies to make it work.AngularJS is perfect for Single Page Applications (SPA). It is basically used for binding JavaScript objects with HTML UI elements.

#2 Question

Explain the architecture of AngularJS?

AngularJS is architecture on 3 components. They are
  • The Template (View)
  • The Scope (Model)
  • The Controller (Controller)
AngularJS extends HTML attributes with Directives and binds data to HTML with Expressions.

#3 Question

What is the Template in AngularJS?

The template is the HTML portion of the angular app. It is exactly like a static HTML page, except that templates contain additional syntax which allows data to be injected in it in order to provide a customized user experience.

#4 Question

What is the scope in AngularJS?

The scope is the object that represents the “model” of your application. It contains fields that store data which is presented to the user via the template, as well as functions which can be called when the user performs certain actions such as clicking a button.

#5 Question

What is the controller in AngularJS?

The controller is a function which generally takes an empty scope object as a parameter and adds to it the fields and functions that will be later exposed to the user via the view.

#6 Question

Explain Directives in AngularJs?

AngularJS directives are extended HTML attributes with the prefix ng-
The 3 main directives of angular js are
  • ng-app:- directive is used to flag the HTML element that Angular should consider to be the root element of our application. Angular uses spinal-case for its custom attributes and camelCase for the corresponding directives which implement them.
  • ng-model:- directive allows us to bind values of HTML controls (input, select, textarea) to application data. When using ngModel, not only change in the scope reflected in the view, but changes in the view are reflected back into the scope.
  • ng-bind:- directive binds application modal data to the HTML view.

#7 Question

List some tools for testing AngularJS applications?

For testing AngularJS applications there are certain tools that you should use that will make testing much easier to set up and run.
Karma
Karma is a JavaScript command line tool that can be used to spawn a web server which loads your application’s source code and executes your tests. You can configure Karma to run against a number of browsers, which is useful for being confident that your application works on all browsers you need to support. Karma is executed on the command line and will display the results of your tests on the command line once they have run in the browser.
Karma is a NodeJS application and should be installed through NPM/YARN. Full installation instructions are available on the Karma website.
Jasmine
Jasmine is a behavior-driven development framework for JavaScript that has become the most popular choice for testing AngularJS applications. Jasmine provides functions to help with structuring your tests and also making assertions. As your tests grow, keeping them well structured and documented is vital, and Jasmine helps achieve this.
Jasmine comes with a number of matches that help you make a variety of assertions. You should read the Jasmine documentation to see what they are. To use Jasmine with Karma, we use the karma-jasmine test runner.
angular-mocks
AngularJS also provides the ngMock module, which provides mocking for your tests. This is used to inject and mock AngularJS services within unit tests. In addition, it is able to extend other modules so they are synchronous. Having tests synchronous keeps them much cleaner and easier to work with. One of the most useful parts of ngMock is $httpBackend, which lets us mock XHR requests in tests and return sample data instead.
Source:https://docs.angularjs.org/guide/unit-testing

 

Tuesday, January 15, 2019

What is AngularJs 4? Is it a good time to learn Angular Js 4?

What is AngularJs 4? Is it a good time to learn Angular Js 4?

It had been Great to learn Angular ,As it is Trending Now.
  1. Learning Angular 4 and Angular 2 are not different .
  2. Angular 4 is the extension of some features to angular 2.
About Angular 2:
  • If any one is newbie and interested to learn Angular ,then better to start with Angular 2.
  • Angular 2 is built around the concept of components, and more precisely, with the Web Components standard in mind.

 

10 Common Interview Questions & Answers for Freshers

10 Common Interview Questions & Answers for Freshers Q1. Tell us about yourself. Here you are definitely not going to tell the int...