top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

What is the difference between component and controller in angular.js?

0 votes
74 views
What is the difference between component and controller in angular.js?
posted Dec 18, 2017 by Manish Tiwari

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Component
In AngularJS, a Component is a special kind of directive that uses a simpler configuration which is suitable for a component-based application structure.

This makes it easier to write an app in a way that's similar to using Web Components or using the new Angular's style of application architecture.

Advantages of Components:
- Simpler configuration than plain directives
- Promote sane defaults and best practices
- Optimized for component-based architecture
-Writing component directives will make it easier to upgrade to Angular

Controller
In AngularJS, a Controller is defined by a JavaScript constructor function that is used to augment the AngularJS Scope.

Controllers can be attached to the DOM in different ways. For each of them, AngularJS will instantiate a new Controller object, using the specified Controller's constructor function:

the ngController directive. A new child scope will be created and made available as an injectable parameter to the Controller's constructor function as $scope.

answer Apr 30, 2018 by Kuldeep Apte
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...