小编Sha*_*per的帖子

AngularJS - 使用ng-style将样式应用于ng-repeat中的第一个元素

我有一个样式对象,我需要为第一个元素设置另一个css样式.我特别为此创建了一个指令,但它不起作用

我将非常感谢你的帮助!

这是代码:

<div class="row" ng-style="rowCss" ng-repeat="top in gridObj" ng-zero>
Run Code Online (Sandbox Code Playgroud)
$scope.rowCss = {
    "height" : rowAndSquareHeight,
    "padding-top": baseLine
}

editorApp.directive('ngZero', ['$document', '$parse', function($document, $parse) {
    return function(scope, element, attr) {
        $(element).css({"padding-top" : "0px"});
    };
}]);
Run Code Online (Sandbox Code Playgroud)

谢谢!

angularjs ng-style

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

标签 统计

angularjs ×1

ng-style ×1