I am working on writing a custom directive.
<ng-selectbox select-function="selectitem(codes)" items="codes"></ng-selectbox>
code.controller("codeCtrl", function($scope) {
$scope.selectitem = function(item){
alert(item);
};
});
code.directive("ngSelectbox", function(){
return {
restrict: "E",
scope: {
items: "=",
selectFunction: "&"
},
template:
"<div>" +
"<ul ng-repeat='item in items'>" +
"<li ng-click='selectFunction(item)'>{{item.TYPE}}</li>" +
"</ul>" +
"</div>"
};
});
when the item in ng-repeat was clicked, I would like to pass the clicked item through selectFunction, but it didn't work. :(
I have no idea what parameter should I put in the html select-function.
thank you very much.