How to change style for before/after in Angular?

前端 未结 3 585
深忆病人
深忆病人 2021-01-04 09:49

I\'m trying implement breadcrumbs with triangles using before/after in the CSS, as shown in this tutorial:

http://css-tricks.com/triangle-breadcrumbs/

Releva

3条回答
  •  庸人自扰
    2021-01-04 10:53

    I would avoid using ng-style in this instance you may find it easier to use ng-class and apply a different class depending, this will allow you to keep all your CSS in a single place rather than overriding within the HTML.

    Simply change your code to:

  • Home
  • Where subCategory should be a boolean, on click you set subCategory and then it will add breadcrumb-color as a class value, you should end up with something like this:

  • Home
  • Some sample css, now you can set the before and after as you please:

    .breadcrumb-color li a {
        background: red;
    }
    
    .breadcrumb-color li a:after { 
        background: red;
    }
    

提交回复
热议问题