Q:

one ng-click function for multiple element Angular

i have something like this :  
<li>
          <a href="#" id="navId" ng-click="toggleStyle()">

                <i class=" fa fa-navicon">
                </i>
           </a>
</li>
<li>
    <a href="#" id="searchId" ng-click="toggleStyle()">
               <i class="fa fa-search"></i>
    </a>

</li>  

How can i use one function for multi elements like this :  
     $scope.toggleStyle = function () {
            if("#navId"){
           //do Stuff
            }
           if("#searchId"){
             //Do somthing else
            }
    }

A:

Just pass whatever parameter you need to the function:
<a href="#" id="navId" ng-click="toggleStyle('navId')">

$scope.toggleStyle = function(param){
  if (param === 'navId') {
    // do stuff
  }
  // ...
}

