- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2022 07:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2022 07:49 AM
The $scope
is the binding part between the HTML (view)
and the JavaScript (controller)
.$scope is an object
in Angular that holds all functions and properties. This properties/method
can be accessed in the html page. As we have done here for method hello ()
in html ng-click
directive.
HTML will be as follows:
<div> <button ng-click="hello()"> Click </button> </div>
Client script will be as follows:
function($scope)
{
/* widget controller */
var c = this; //function
$scope.hello = function()
{
alert("Hello World");
}
}
As you can see above that the method hello ()
in html ng-click
directive, this method is bound between client script and HTML due to $scope.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2022 07:49 AM
The $scope
is the binding part between the HTML (view)
and the JavaScript (controller)
.$scope is an object
in Angular that holds all functions and properties. This properties/method
can be accessed in the html page. As we have done here for method hello ()
in html ng-click
directive.
HTML will be as follows:
<div> <button ng-click="hello()"> Click </button> </div>
Client script will be as follows:
function($scope)
{
/* widget controller */
var c = this; //function
$scope.hello = function()
{
alert("Hello World");
}
}
As you can see above that the method hello ()
in html ng-click
directive, this method is bound between client script and HTML due to $scope.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2022 07:50 AM
Hi,
Please refer below doc for better understanding
Please mark my response as correct answer or helpful if applicable