Thanks for the reply, I corrected all the typos and it is working fine.
On Tuesday, December 9, 2014 11:39:35 PM UTC+5:30, Eric Eslinger wrote: > > The code you provided has a number of typos in it. If you clean up those > typos, what you are attempting to do will work. > > This is by no means exhaustive, but: > > 1) You need a comma after the templateUrl line (json syntax) > 2) The templateUrl line should be a template line instead (as you're > providing the template via a string rather than a url) > 3) The template string should have ng-click="Click()" rather than > ng-click='Click()', as the single-quotes inside single-quotes in the > template string makes that invalid javascript syntax. > 4) app..directive should read app.directive > 5) not a typo, but your directive doesn't need a controller if you don't > do anything with it. > > Try building a plunker <http://plnkr.co/> with your code to demonstrate > your problem. > > Eric > > On Tue Dec 09 2014 at 6:27:09 AM ajeesh aji <[email protected] > <javascript:>> wrote: > >> I want to handle an event inside my directive. I have given my code below. >> >> var app = angular('myApp',[]); >> >> app. .directive('participantCtrl', function () { >> return { >> restrict: 'E', >> scope: { >> }, >> templateUrl: '<div><button ng-click='*Click*()'>Click >> me</button><div>' >> controller: function ($scope) { >> >> }, >> link: function (scope, element, attrs) { >> scope.*Click*= function () { >> alert('link'); >> }; >> >> >> } >> }; >> >> }) >> >> >> >> I want to get Click() function inside my directive. Can anybody help me? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "AngularJS" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at http://groups.google.com/group/angular. >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
