Using jquery handler in Angular
I have been using Angular for a bit and really find myself much more
efficient and produce many few lines of code than I did in Backbone and
jquery. However, I work with other developers that are primary creating in
Backbon/jquery components/controls we all share. Since these are complex
components/controls that I cannot rewrite in Angular I need to find a way
to use them from within Angular.
In the specific case I am dealing with a control that create a dialog that
lets users created entries in a series of help request systems or log
bugs. This code is working in a number of applications. Here is a simple
example :
<div class="foo">Help</div>
And then the handler.
$(".foo").ShowHelp({project:"myproject", app:"MyApp"});
Note "foo" is used to position the dialog.
In Angular I tried to create add an ng-click directive and in my
controller handle the click, but ShowHelp is not invoked. This is the
angular code:
<div class="foo" ng-click="doShowHelp()">Help</div>
In the controller I have
$scope.doShowHelp = function() {
console.log("in doShowHelp");
$(".foo").ShowHelp({project:"myproject", app:"MyApp"});
};
I see the log message in the console, but nothing seems to happen. Any
ideas on what I am doing wrong.
Thanks in advance
No comments:
Post a Comment