AngularJS Controllers

AngularJS Controllers control the data of AngularJS applications. AngularJS controllers are regular JavaScript Objects.

Sample Code:

<!DOCTYPE html>
<script src= ""></script>
<div ng-app="myApp" ng-controller="SampleCtrl">
First Name: <input type="text" ng-model="firstName"><br>
Last Name: <input type="text" ng-model="lastName"><br>
Full Name: {{fullName()}}
var app = angular.module('myApp', []);
app.controller('SampleCtrl', function($scope) {
$scope.firstName = "Firstname";
$scope.lastName = "Lastname";
$scope.fullName = function() {
return $scope.firstName + " " + $scope.lastName;



No comments:

Post a Comment

Sharing is Caring!!! Share this with your friends!!!

submit to reddit