Controllers – AngularJS
Controllers are used to control the flow of data in AngularJS application. ng-controller directive is used to define controller. Controllers are JavaScript objects that contain attributes and functions. Attributes are also called as properties. $scope object is used to invoke the controller. $scope refers to the application which uses the application. We are creating a simple Controller here: <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular.min.js"></script> <div ng-app="firstApp" ng-controller="firstCtroller"> {{ state + " " + city }} <div>Full Address: {{address}}</div> </div> <script> var app = angular.module("firstApp", []); app.controller("firstCtroller", function($scope) { $scope.state = "Hyderabad"; $scope.city = "Sikandrabad"; $scope.address = $scope.state + " " + $scope.city; }); </script> […]
Events – AngularJS
AngularJS provides event directives. There are some common events provided by AngularJS to use in HTML. ng-mousedown – (onmousedown in javascript) ng-mouseenter – (onmouseenter in javascript) ng-mouseleave – (onmouseleave in javascript) ng-mousemove – (onmousemove in javascript) ng-mouseover – (onmouseover in javascript) ng-mouseup – (onmouseup in javascript) ng-blur – (onblur in javascript) ng-change – (onchange in javascript) ng-click – (onclick in javascript) ng-copy – (oncopy in javascript) ng-cut – (oncut in javascript) ng-dblclick – (ondblclick in javascript) ng-focus – (onfocus in javascript) ng-keydown – (onkeydown in javascript) ng-keypress – (onkeypress in javascript) ng-keyup – (onkeyup in javascript) ng-paste – (onpaste in […]
