This code block shows an example of HTML:
<div class="main" ng-controller="companies">
<ul style="list-style: none;">
<li ng-repeat="company in companies | orderBy:'name' | filter:companies_filter">
<a href="#!/companies/{{company.id}}" ng-click="companySelected(company)">
{{company.name}}
</a>
</li>
</ul>
</div>
The following excerpt is from the router.js file:
...
.when('/companies', {
templateUrl: '../html/companies.html',
controller: 'companies'
})
.when('/companies/:companyId', {
templateUrl: '../html/companies.html'
});
....
This JavaScript snippet demonstrates a working function:
$scope.companySelected = function(company) {
console.log(company);
}
An issue arises when scrolling through a large list: clicking on a company or applying a filter causes the list to jump back to the top. How can this behavior be fixed so that the list remains in its current position?