Hi Guest 1 HomePage 1 Jobs 1 WalkIn 1Articles  

 :) Latest Topic
Numbers And Strings
Objects And Array
AngularJS VS JavaScript
Controllers in Files
Load the Library
AngularJS Directives
Repeating Directive
AngularJS Facts
Create Directives
Restrict Directive
Custom Filter
AngularJS Services
AngularJS Service 2
AngularJS Tables
Select Option
Select Option 2
AngularJS Forms
Form Validation
Validation CSS
Validation Example
AngularJS API
AngularJS $http
AngularJS Database
AngularJS HTML DOM
AngularJS Events
Custom Validation
AngularJS Tutorial
AngularJS Introduction
Angular init Directive
AngularJS Expressions 1
AngularJS Applications
AngularJS Expressions 2
Angular CSS Properties
AngularJS JSON
AngularJS Modules
Controller Basic
Add a Directive
Model Directive
Validate Inputs
CSS Classes
Data Binding
AngularJS Controller
AngularJS Scope
Root of Scope
AngularJS Filters
 


  

 
AngularJS Controller
Question Posted on 13 Apr 2020

Home >> Tutorial >> AngularJS >> AngularJS Controller


AngularJS Controller
As we knows now that Applications in AngularJS are controlled by the controllers. As we also know there is immediate synchronization between the Model and the View. And controller can be completely separated from the view and will concentrate on Model data. And with the data binding in AngularJS the view will reflect changes made in controller. AngularJS controllers control the data of AngularJS applications.


AngularJS Controller
AngularJS controllers are regular JavaScript Objects. The ng-controller directive defines the application controller. And controller is JavaScript object which is created by standard JavaScript object constructor.


AngularJS JavaScript Controller
Now i will give some details on the above example. AngularJS

application is defined by ng-app="myTestApp". And the application run inside the < div> tag. And the ng-controller="myTestCtrl" attribute is and AngularJS directive which defines the controller.

And myTestCtrl function is a JavaScript function.

And AngularJs will invoke the controller witha $scope object.

In AngularJS $scope is application object which is owner of application variable and function.

Controller creates 2 properties in scope and these are EmployeeFirstName and EmployeeLastName.

And ng-model directives bind input fields to the controller properties.





Other Important Questions
Numbers And Strings
Objects And Array
AngularJS VS JavaScript
Controllers in Files
Load the Library







 
Top Searches:asp net questions vb net questions sql query uddl questions class javascript Questions sharepoint interview questions and concept silverlight questions and concept wcf questions beans general knowledge ajax questions
PHP | Biztalk | Testing | SAP | HR |