Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm using bootstrap Modal window for adding a new member for my site, to open it, since I'm using AngularJS, I have to add a ng-click="open()" parameter to a button, but since a plugin I'm using is generating buttons using JS, I don't really see how I can add it to the JS code, it looks like this:

case "add":
    var itemZ = new primitives.orgdiagram.ItemConfig();
    itemZ .title = "Z Title";
    itemZ .description = "Z Description";
    itemZ .image = "http://www.basicprimitives.com/demo/images/photos/z.png";
    data.context.items.push(itemZ);

    jQuery(".basicdiagram").orgDiagram("update", primitives.orgdiagram.UpdateMode.Refresh);
    break;

so is there a way I could sneak in that ng-click property?

share|improve this question
    
I'm not sure but did you try to use primitives.common.attr? basicprimitives.com/… –  interlude Sep 11 '13 at 12:09
    
I had a go with it, but, as I believe after the result, that's not function I'm looking for. –  Xeen Sep 11 '13 at 12:19
    
It's probably not answering your question completely, but here a way to reach an angular scope function from classic javascript code (that way, you can simulate the ng-click): /* document.getElementById('page-data') => angular view container */ angular.element( document.getElementById('page-data') ).scope().$apply( function(scope) { scope.yourScopeMethod(); }); –  Scalpweb Sep 11 '13 at 14:44
    
I believe your real problem is that you're using a plugin to generate buttons. Why? Angular can almost certainly do whatever you're doing in a much better fashion. I usually hear of someone trying to use a jQuery plugin that they could have re-written in angular from scratch in 10 minutes. –  m59 Sep 11 '13 at 15:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.