Angularjs 角度ui布局-添加拖动结束/面板大小调整事件
我在和警察一起工作 该链接是源代码,第211行有以下代码要处理Angularjs 角度ui布局-添加拖动结束/面板大小调整事件,angularjs,angularjs-directive,angular-ui,Angularjs,Angularjs Directive,Angular Ui,我在和警察一起工作 该链接是源代码,第211行有以下代码要处理mouseup: htmlElement.on('mouseup touchend', function () { htmlElement.off('mousemove touchmove'); }); 我需要一个回电: htmlElement.on('mouseup touchend', function () { htmlElement.off('mousemove touchm
mouseup
:
htmlElement.on('mouseup touchend', function () {
htmlElement.off('mousemove touchmove');
});
我需要一个回电:
htmlElement.on('mouseup touchend', function () {
htmlElement.off('mousemove touchmove');
scope.onDragEnd();
});
要在插件外部响应此事件,请执行以下操作:
<div ui-layout on-drag-end="vm.layoutResized()"> ... </div>
但是,
vm.layoutResized()
不会被调用。有人能看一下链接源并告诉我如何通过嵌套作用域传递此函数,以便在我调用它的位置定义它吗?从以下内容更改指令中的属性:
scope: {
onDragEnd: '&'
}
为此:
scope: {
'drag-end': '&onDragEnd'
}
请参阅以下链接:
我在关于指令的AngularJS文档中看到了这种格式。您必须修改AngularUI布局插件/指令 在uiLayoutCtrl中添加一个函数,该函数应在内部调用另一个指令级范围变量,并应在内部执行layoutResize
//Method called from actual resize event
triggerResize: function (eve) {
$scope.resize(eve);
}
//External facing method that will be called
scope: {
'resize': '&onResize'
},
//Usage
<div ui-layout on-resize="ResizeFn()">
//从实际调整大小事件调用的方法
triggerResize:函数(eve){
$scope.resize(eve);
}
//将被调用的外部面向方法
范围:{
“调整大小”:“&onResize”
},
//用法
演示:
在此链接中添加了更新的angular ui布局代码。我还遇到了一个问题,需要更改其中一个ui布局指令“uiSplitbar” 但是,要使用override直接更改它,请设置它将在base指令之后运行的指令的优先级 我写了一篇关于如何处理角度ui布局问题的帖子,请参见下面的链接
在angularJS ui布局插件中,我没有看到关于拖动端的指令。在HTML中,这是如何工作的?您有自定义指令吗?没有,我正试图通过该属性将函数绑定到
ui布局
指令的范围。这就是包含的范围:{onDragEnd:'&}
的作用。在函数之前,我已经将这样的选项传递给了指令。然而,我看到它做了一些很好的技术,优先级为-1。我最终修改了这个问题的源代码,但我肯定会在下次尝试这种技术。
//Method called from actual resize event
triggerResize: function (eve) {
$scope.resize(eve);
}
//External facing method that will be called
scope: {
'resize': '&onResize'
},
//Usage
<div ui-layout on-resize="ResizeFn()">