How to CSS style AngularJS directive?

前端 未结 4 1998
醉话见心
醉话见心 2021-01-31 10:26

Assuming I have a directive \"mydirect\" with a template that contains a lot of divs with a lot of nested classes. For example:

4条回答
  •  旧巷少年郎
    2021-01-31 10:54

    Angular Directive with Custom CSS.

    app.directive('bookslist', function() {
    
        return {
        	scope: true,
            templateUrl: 'templates/bookslist.html',
            restrict: "E",
            controller: function($scope){
    
            },
            link: function(scope, element, attributes){
            element.addClass('customClass');
          }
    
        }
    
    });
    .customClass table{
    	!background: #ffffd;
    
    }
    .customClass td{
    	border: 1px solid #ffffd;
    
    }

提交回复
热议问题