Angularjs मे Scope एक ऐसा Object होता है जो View और Controllers के बीच Share Context के रूप मे काम करता है और Scope Application Model से Related Information को आदान-प्रदान करने के लिए दो Layers को Capable बनाता है.
Angularjs मे Scope योजना के साथ Controllers मे शामिल होने के Role को निभाता है. यह View और Controllers के लिए Available होता है.
AngularJS मे $scope एक Built-in Object है जिसमे Application Data के और तरीके शामिल होते है. इसमे आप एक Controller Function के अंदर $scope Object मे Properties को बना सकते है और इसके लिए एक Value या Function को Specified कर सकते है.
<!DOCTYPE html>
<html>
<head>
<title>Angular Scope Example</title>
<script src =
"https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js">
</script>
</head>
<body ng-app="myNgApp">
<h1>AngularJS Scope</h1>
<div ng-controller="myController">
This is Message <br />
<br />
<span ng-bind="message"></span> <br />
<input type="text" ng-model="message" />
</div>
<script>
var ngApp = angular.module('myNgApp', []);
ngApp.controller('myController', function ($scope) {
$scope.message = "Hello Tutorialsroot!";
});
</script>
</body>
</html>
AngularJS Application मे प्रत्येक Controller के लिए एक अलग $scope Object बनता है और Inject करता है. इसलिए एक Controller के अंदर $scope के साथ जुड़े Data और Methods को दूसरे Controller मे नही पहुंचाया जा सकता है.