ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Difference between this and $scope in Controller in AngularJS<p>Hi <a class="username" rel="rani">rani,</a></p> <p>Check this example.</p> <p><strong><span style="text-decoration: underline;">This and $scope</span></strong></p> <p><span style="text-decoration: underline;">HTML</span></p> <div class="demo_block"> <pre class="brush: html">&lt;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;script type=&#34;text/javascript&#34; src=&#34;https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.8/angular.min.js&#34;&gt;&lt;/script&gt; &lt;script type=&#34;text/javascript&#34;&gt; var app = angular.module(&#39;MyApp&#39;, []); app.controller(&#34;MyController&#34;, function ($scope) { this.title = &#39;Some title&#39;; }); app.controller(&#34;MyController1&#34;, function ($scope) { $scope.title = &#39;Some title&#39;; }); &lt;/script&gt; &lt;/head&gt; &lt;body ng-app=&#34;MyApp&#34;&gt; &lt;div ng-controller=&#34;MyController as main&#34;&gt; {{main.title}} &lt;/div&gt; &lt;hr /&gt; &lt;div ng-controller=&#34;MyController1&#34;&gt; {{title}} &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;</pre> </div> <p><a class="demo button orange btn btn-red">Demo</a></p> <p>Refer below links for more details.</p> <p><a href="https://stackoverflow.com/questions/22806681/difference-between-this-and-scope-in-the-controller">https://stackoverflow.com/questions/22806681/difference-between-this-and-scope-in-the-controller</a></p> <p><a href="https://stackoverflow.com/questions/11605917/this-vs-scope-in-angularjs-controllers">https://stackoverflow.com/questions/11605917/this-vs-scope-in-angularjs-controllers</a></p> <p><a href="https://ultimatecourses.com/blog/digging-into-angulars-controller-as-syntax">https://ultimatecourses.com/blog/digging-into-angulars-controller-as-syntax</a></p> <p><strong><span style="text-decoration: underline;">track by</span></strong>&nbsp;</p> <p>track by basically tell angular to generate a single DOM element per data object in the given collection.&nbsp;</p> <p>You can track by $index if your data source has duplicate identifiers.&nbsp;</p> <p>If you do need to repeat duplicate items, you can substitute the default tracking behavior with your own using the track by expression.&nbsp;</p> <p>Refer below link for example.&nbsp;</p> <h1 class="header"><a class="title f16" href="https://www.aspforums.net/Threads/196228/Display-categorized-filter-data-in-HTML-Table-using-AngularJS/">Display categorized filter data in HTML Table using AngularJS</a></h1> <p>Refer below link for more details.</p> <p><a href="https://www.c-sharpcorner.com/blogs/use-of-track-by-in-angular-js">https://www.c-sharpcorner.com/blogs/use-of-track-by-in-angular-js</a></p>https://www.aspforums.net:443/Threads/812274/Difference-between-this-and-scope-in-Controller-in-AngularJS/https://www.aspforums.net:443/Threads/812274/Difference-between-this-and-scope-in-Controller-in-AngularJS/Wed, 10 Jul 2019 05:44:08 GMT