AngularJS Controller

What is the role of Controller in AngularJS? Data flow in the application is maintained by controllers in AngularJS. In general terms, AngularJS Controller is a JavaScript object which is basically used to maintain the flow of data in the angular application. To make a controller we will use ng-controller directive. Let us understand by a simple example:- For Example: <div ng-app=”myModule” ng-controller=”myController”> First Name: <input type=”text” ng-model=”firstName”><br> Last Name: <input type=”text” ng-model=”lastName”><br>...
پاتی برخه

AngularJS – Data Binding

What is data binding in AngularJS? AngularJS application is displayed in Hyper Text Markup Language container which is also representing a view. Data Binding is simply used to communication between view and model. For Example : <div ng-app=XCHARXNewModuleXCHARX ng-controller=XCHARXNewControllerXCHARX> <p ng-bind=XCHARXstudentNameXCHARX></p> </div> <script> var app = angular.module(XCHARXNewModuleXCHARX, []); app.controller(XCHARXmyCtrlXCHARX, function($scope) { $scope.studentName = XCHARXalokXCHARX; $scope.studentId = “1XCHARX; }); </script> Output: XCHARX alok...
پاتی برخه
GTranslate Your license is inactive or expired, please subscribe again!