Edit: This post Is there a better way to do optional function parameters in Javascript? provides an answer to this question.
This is my controller:
.controller("NavTabController", ['TabService', function(TabService) {
        var self = this;
        self.switchTab = function(currentTab, dropDown) {
            TabService.switchTab(currentTab, dropDown);
        }
}])
and this is the factory:
.factory("TabService", [function() {
    var tab = "home";
    return {
        switchTab: function(currentTab, dropDown) {
            tab = currentTab;
        }
    }
}])
In my HTML, I have this:
<a href="#" ng-click="ctrl.switchTab('home')">Home</a>
<a href="#" ng-click="ctrl.switchTab('home', 'middle')">Optional</a>
As you can see, I want dropDown to be optional because sometimes it is not provided.
With that said, what is the recommended way to have an optional parameter for an AngularJS function?
 
     
     
    