$watch keeps track of a variable and its value <div ng-controller="mycontroller"> <input ng-model="a"> <div> {{ b }}</div> </div> app.controller('mycontroller',function(){ $scope.a=1; $scope.b=2; }) whenever a databinding with the scope variable is created , a $watch will automatically be created by the angular js framework $watch -a:1 and $watch -b:2, And this will be used by the digest cycle . Since C is not used in any databinding , so $watch is not created for variable c. If the value gets changes for those variable, angular performs necessary updates to the DOM elements With the help pg $watch custom functions can be created which are called $watchListeners and this gets executed as soon a the value of the variables is changed They are mainly used for databinding and angular Js constantly uses watchers behind the scene number of watchers should be kept less the 2000 There are number of ways to get...
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Memory_understanding { class Reapting_elements { public void getfirstrepeatingelements(int[] arr) { int min = -1; int element=0; HashSet<int> set = new HashSet<int>(); for (int i = arr.Length-1; i >= 0; i--) { if(set.Contains(arr[i])) { min=i; element=arr[i]; ...
Understading Callback method wher a function is executed not on the main thread but on a child thread that it created . Similary there are different ways of executing function created on the child thread. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace Memory_understanding { public delegate void sumofnumberscallback(int sumofnumber); class A { int target; public A(int num) { this.target= num; } public void printNumber(int n) { ...
Comments
Post a Comment