1.

What is the difference between a service() and a factory()?

Answer»
factory()service()
The factory function allows developers to add certain logic before the creation of an object.This one is a constructor function which helps creating the object with a new keyword. Developers can add functions and properties to a service object by using the keyword.
It will RETURN the created object.It returns nothing.
Syntax:app.factory('serviceName',function(){ return serviceObj;}Syntax:app.service('serviceName',function(){})
50. What is the difference between Angular 2 and AngularJS?
 AngularJSAngular 2
1.No mobile supportMobile-oriented
2.Only supports Dart, ES6 and ES5Offer more language choices
3.Easy to SET upDependent on libraries. REQUIRES efforts to set up.
4.Based on controllers and scopeComponent-based.
Also Read: AngularJS VS. Angular 2 vs. Angular 4: What's the Difference


Discussion

No Comment Found