Use Controller in Angularjs?

Controller in Angularjs

AngularJS Controllers control the data of AngularJS applications. A Controller is the most useful part of an AngularJS application. It performs majority of Javascript functions related and UI related tasks.AngularJS controller is defined with Ng-Controller instructions to control the flow of data in the application. AngularJS Controller is a Javascript Object which includes Attributes and Functions.

The Ng-Controller Directive is used to connect all types of websites with Angularjs Controller. The best thing about a website built using AngularJs is that it is based on Angularjs Controller.

For Example : –

<!DOCTYPE html>
<html>
<head>
<title>Angular JS Controller Example</title>
<script src ="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js">
</script>
</head>
<body>
<h2>This is AngularJS Application</h2>
<div ng-app = "mainApp" ng-controller = "studentController">
Enter first name: <input type = "text" ng-model = "student.firstName">
<br><br>
Enter last name: <input type = "text" ng-model = "student.lastName">
<br><br>
You are entering: {{student.fullName()}}
</div>
<script>
var mainApp = angular.module("mainApp", []);
mainApp.controller('studentController', function($scope) {
$scope.student = {
firstName: "Jyoti",
lastName: "Chaurasiya",
fullName: function() {
var studentObject;
studentObject = $scope.student;
return studentObject.firstName + " " + studentObject.lastName;
}
};
});
</script>
</body>
</html>
Angular JS Controller Example

This is AngularJS Application

Enter first name:

Enter last name:

You are entering: {{student.fullName()}}
Cialis (Tadalafil) är den främsta konkurrenten till Viagra (Sildenafil) på marknaden för erektil dysfunktion. köpa Cialis i Sverige föredras av många på grund av sin längre varaktighet och anses vara det mest kostnadseffektiva varumärkesbaserade ED-läkemedlet som finns tillgängligt i Sverige. Cialis finns i två varianter: Cialis och Cialis Daily, och fyra olika doseringar: 2,5 mg, 5 mg, 10 mg och 20 mg, erbjuder Cialis också en rad olika alternativ för att passa patientens behov.