相关疑难解决方法(0)

Angular JS可调整大小的div指令

我的网站将有多个部分,每个部分我打算可以调整大小.为了实现这一点,我制定了一个"可调整大小"的指令,例如:

<div class="workspace" resize="full" ng-style="resizeStyle()">
<div class="leftcol" resize="left" ng-style="resizeStyle()">
Run Code Online (Sandbox Code Playgroud)

使用类似于以下内容的指令:

lwpApp.directive('resize', function ($window) {
    return {
        scope: {},

        link: function (scope, element, attrs) {
            scope.getWinDim = function () {
                return {
                    'height': window.height(),
                    'width': window.width()
                };
            };

            // Get window dimensions when they change and return new element dimensions
            // based on attribute
            scope.$watch(scope.getWinDim, function (newValue, oldValue) {
                scope.resizeStyle = function () {
                    switch (attrs.resize) {
                    case 'full':
                        return {
                            'height': newValue.height,
                            'width': (newValue.width - dashboardwidth)
                        };

                    case 'left':
                        return …
Run Code Online (Sandbox Code Playgroud)

scope resize controller directive angularjs

45
推荐指数
2
解决办法
7万
查看次数

angular 4+ 水平调整 div 的大小

我是 angular 4 的新手,我一直在尝试创建一个可调整大小的 div(水平),但我无法实现。我想单击抓取来调整 div 的大小。我想水平调整文本区域的大小。也在下面的链接中,鼠标事件应用于文档,但我希望鼠标事件仅应用于抓取类单击而不是文档。请帮帮我

谢谢。

我试过这个 https://stackblitz.com/edit/angular-text-resizable-zvp3ns?file=app%2Fapp.component.ts

html css angular

1
推荐指数
2
解决办法
1万
查看次数

标签 统计

angular ×1

angularjs ×1

controller ×1

css ×1

directive ×1

html ×1

resize ×1

scope ×1