angularjs - How to register the event in $scope using handlebar in twitter typeahead -
i using latest twitter typeahead using custom templates using angularjs.
i able desired output have button in custom templates appears when enter in dropdown.
here plunker : http://plnkr.co/edit/u5zkxhry0bcu6u5r0wup?p=preview
now when click on add button event not getting fired. think event not getting registered in $scope. how can on here ?
$('#prependedinput').typeahead({ hint: true, highlighter: function (x) { return x; }, minlength: 3, }, { name: 'members', displaykey: 'value', source: getusersearchdata, templates: { suggestion: handlebars.compile('{{member}}') } }); handlebars.registerhelper('member', function (items) { var item = this; var items = '<li><a><div class="row"><img style="height: 40px; float:left" src=' + getavatarurl(item) + ' /><span style="padding: 0.5em; float:left;"> ' + getdisplayname(item) + '</span><button class="btn btn-sm pull-right" ng-click="confirmadddialog(' + item.id + ')">add</button></div></a></li>'; return new handlebars.safestring(items) });
i have 1 function fire modal popup.
$scope.confirmadddialog = function (userid) { flashsvc.add('we hit...'); };
how can register event using template.
Comments
Post a Comment