What is the difference between ‘this’ vs $scope in angularjs controllers?
Answer / Sangeet Kumar Yadav
'this' refers to the window object by default in JavaScript, but in AngularJS controllers, it refers to the controller itself. To access properties and methods on the scope, use `$scope`. If you want to refer to the same object as both 'this' and $scope, you can use `function MyController($scope) { this.$scope = $scope; }`.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is service heroservice?
What is json web token in angularjs?
What did you like about working with angular 2?
How AngularJS compilation is different from other JavaScript frameworks?
What's new in angular 8?
Explain what is the difference between link and compile in angular.js?
What are animating elements in angularjs?
What is the purpose of transclusion?
What are services in javascript?
How to validate email in angular 4 using formgroup or custom regexp?
What are the components in angular2?
What is the main purpose of find index in angularjs, and what does it return if no value is found?