I am trying to initiate the opening of a modal window and instead of triggering it with "ng-click", I would like to call an angular expression from another JS function. How can I do that?
Current implementation:
index.html
<div ng-controller="modalWindow" class="text-letf">
  <a class="button button-default" ng-click="openModal()">Open Modal</a>
</div>
modal.js
   var app = angular.module('app', ['ui.bootstrap']);
    app.controller('modalWindow', function ($scope, $uibModal) {
    $scope.openModal = function () {
        $uibModal.open({
            template: ['<div class="modal-header">',
                '<a class="close" ng-click="$dismiss()"><span class="icon-close"></span></a>',
                '<h1 class="modal-title">Example Modal</h1>',
            '</div>',
            '<div class="modal-body">',
                '<p>Lorem ipsum dolor sit amet, consectetuer adipiscing</p>
            '</div>',
            '<div class="modal-footer">',
                '<a class="button button--fixed" ng-click="$dismiss()">Cancel</a>',
                '<a class="button button--fixed button--cta" ng-click="$close()">OK</a>',
            '</div>'].join(' ')
        });
    }
});
My task is to call openModal expression from another function:
// Form a modal window
marker[element.dev_addr].on('click',function() {
  // Was trying to trigger opening by addressing to the controller
  // but with no luck so far.
  angular.element(document.getElementById('modalWindow'))
         .triggerHandler('click');
});
 
    