如何在html中以角度显示自定义指令的作用域
How to display the scope in html from a custom directive in angular?
我是angular js的新手。
如何在HTML中显示e.width
和e.height
的值?我可以用一下这里的示波器吗?
.directive( "cropping", [function ($scope) {
return {
restrict: "A",
link : function ( $scope, $el, $attr ) {
$attr.$observe( "src", function ( src ) {
jQuery( '#cropImage' ).cropper('destroy');
jQuery( '#cropImage' ).cropper( {
viewMode : 0,
zoomable : false,
preview: ".extra-preview",
dragMode : 'crop',
guides : true,
highlight : true,
cropBoxMovable : true,
cropBoxResizable: true,
crop : function ( e ) {
// Output the result data for cropping image.
console.log( e.width );
console.log( e.height );
}
} );
} );
}
}
} ] );
使用下面的代码,您将直接获得HTML的高度和宽度。
console.log( e[0].offsetHeight);
console.log( e[0].offsetWidth);
相关文章:
- 谷歌水印未显示在自定义搜索框中
- 如何使用Node/Express显示有关特定错误的自定义html页面
- dataTables-如何自定义分页类型以显示最后一个页码后面的省略号,
- 如何在用户按下F5键或单击浏览器时显示自定义的fancybox's后退/关闭按钮
- 自定义HTML元素属性未显示-Web组件
- 如何在html中以角度显示自定义指令的作用域
- 嵌入的自定义谷歌地图不会在没有刷新的情况下显示
- 使用Plaid Link显示自定义用户名和密码模式对话框
- MVC中关于表的自定义工具提示-每行显示数据
- Select2-使用自定义模板时不显示占位符
- 根据屏幕分辨率显示自定义背景图像
- 为自定义网站创建JavaScript搜索框,创建显示搜索结果的弹出窗口
- 登录时显示自定义错误消息
- 如何在 AngularJS 中创建和显示多个自定义指令
- 自定义UI下拉按钮不显示所有命令
- jQuery自定义验证只显示最后一个字段的错误
- AngularJS自定义指令ng显示/ng隐藏
- Safari限制?使用多种方法来显示多个自定义模式对话框
- jQuery UI自动完成自定义显示,如何关注子级而不是一级子级
- 自定义显示/隐藏链接