AngularJS Tutorial 7- Controllers

Опубликовано: 29 Сентябрь 2024
на канале: Nisha Singla
1,293
25

In this video,we are going to cover about Controllers in AngularJS.
In Angular controller is defined by a JavaScript constructor function and the role of the controller is to expose data to our view via $scope.

$scope is act like a glue between controller and view.

app.controller("userController",function($scope){
$scope.name="John";
});

If you want to use this controller in your view, you need to use a directive called ng-controller to bind controller to view.

You can also add methods on $scope to manipulate the behavior of view.