I saw a javascript solution that looks something like this:
var select = document.getElementById('selectId') select.click();
Is there an AngularJS approach / best practice to the same? (On top of my head you wrap the above ng-click code)
Yes there is. Here's the angular equivalent of what you have in JavaScript
angular.element('#selectId').trigger('click');
Job example
Any DOM manipulation in angular must be done inside the directive.
View
<div id="selectId" clickMe>content</div>
. - , , , dom. JQlite, .
app.directive('click-me', function(){ return{ link(scope, el, attr){ $(el).trigger('click'); } } });
Source: https://habr.com/ru/post/1608757/More articles:Linear interpolation (lm) in R, strange behavior - rCleaning and serializing Spark Closure OOM - javaskip invalid csv line - javaAngular nameless ng-app - angularjsAlertDialog inside AlertDialog - androidЛучшая структура данных/файл для хранения Matrix для чтения в Ruby on Rails? JSon? YAML? Xml? - databaseHow to get an ad id in Android or iOS IDFA through a mobile site? - androidCan concepts replace all other instances of the template keyword? - c ++Can someone explain to me how this function works? - javascriptHow does implicit dependency injection work in AngularJS? - javascriptAll Articles