angularjs ng-click "How can I use javascript’s setAttribute() to create ng-click attribute with some function"

I would like to be able to select a button using querySelector and set an attribute of “ng-click=doSomething()”

I have tried selecting the button and then setAttribute(“ng-click”, “doSomething()”) but its not working

my DOM:

<body>
    <div ng-app="myApp" ng-controller="mainCtrl">

        <button id="myBtn">click Me</button>

    </div>
    <script src="./js/app2.js"></script>
</body>

my javascript:

(function() {
    "use strict";

    angular.module("myApp", []).controller("mainCtrl", mainCtrl);

    /** @ngInject */
    function mainCtrl($scope) {

      init();
      function init() {
          $scope.doSomething = () => {
              console.log("doing something");
          }
          let btn = document.querySelector('#myBtn');
          btn.setAttribute("ng-click", "doSomething()");
      }
    }
  })();

when I click the button it should console log something.

Source: AngularJS