You need to pass the function to the directive from the parent controller, like below (I am free-handing without testing because you didn't provide a plunk, so I am sure you will need to adjust the code. The point is that the function gets passed as a param. If you don't know how to pass variables to directives from the parent controller, you won't understand this, so read up on that first). Note that I added 'scope' to your directive - that's where you define params for your directive, to be passed to the new scope of your directive:
Your directive in the html:
<chosen select-recepient-country = "selectRecipientCountry"></chosen>
Your directive code:
uiComponentsModule.directive('chosen', [ function () {
return {
scope: {
selectRecipientCountry: '&selectRecipientCountry',
},
link: function(scope, element, attrs) {
scope.$watch(function (newVal, oldVal) {
scope.selectRecipientCountry(x)
})
}
}
}])
For en explanation, see the article here:
http://weblogs.asp.net/dwahlin/creating-custom-angularjs-directives-part-3-isolate-scope-and-function-parameters
You are looking for:
Option 2: Storing a Function Reference and Invoking It
Edit: We have a good example of passing functions here:
AngularJS - pass function to directive
Also note that:
scope: {
myFunction: '&',
}
and
scope: {
myFunction: '&myFunction',
}
are equivalent. One just explicitly names the attribute in which it will look for the variable and the other assumes the attribute name will be the same as the scope variable name.