Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将AngularJS ng单击选项添加到javascript生成的按钮?_Javascript_Angularjs_Angularjs Ng Click - Fatal编程技术网

如何将AngularJS ng单击选项添加到javascript生成的按钮?

如何将AngularJS ng单击选项添加到javascript生成的按钮?,javascript,angularjs,angularjs-ng-click,Javascript,Angularjs,Angularjs Ng Click,我使用bootstrap模式窗口为我的站点添加一个新成员,打开它,因为我使用AngularJS,我必须向按钮添加一个ng click=open参数,但是因为我使用的插件使用JS生成按钮,我真的不知道如何将其添加到JS代码中,它看起来是这样的: case "add": var itemZ = new primitives.orgdiagram.ItemConfig(); itemZ .title = "Z Title"; itemZ .description = "Z De

我使用bootstrap模式窗口为我的站点添加一个新成员,打开它,因为我使用AngularJS,我必须向按钮添加一个ng click=open参数,但是因为我使用的插件使用JS生成按钮,我真的不知道如何将其添加到JS代码中,它看起来是这样的:

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;

那么,有没有办法偷偷进入ng click属性?

我不确定,但您是否尝试使用primitives.common.attr?我试过了,但是,正如我在结果之后相信的那样,这不是我想要的函数。它可能没有完全回答你的问题,但这里有一种从经典javascript代码获得角度作用域函数的方法,您可以模拟ng click:/*document.getElementById'page-data'=>angular视图容器*/angular.element document.getElementById'page-data.scope.$apply functionscope{scope.yourScopeMethod;};我相信你真正的问题是你正在使用一个插件来生成按钮。为什么?Angular几乎可以肯定地以更好的方式做任何你正在做的事情。我经常听说有人试图使用jQuery插件,他们可以在10分钟内从头开始重新编写。