You can use dynamic html attributes for content, for example: JSBin: http://jsbin.com/sepino/edit?html,css,js,output
<!DOCTYPE html> <html ng-app="test"> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script> <script language="JavaScript"> angular.module('test',[]).controller('testController',function(){ this.textbefore = 'left '; this.textafter = ' right'; }); </script> <style> .bar:before { content: attr(data-textbefore); height: 20px; } .bar:after { content: attr(data-textafter); height: 20px; } </style> <meta charset="utf-8"> <title>JS Bin</title> </head> <body ng-controller="testController as myCtrl"> <div class="bar" data-textbefore="{{myCtrl.textbefore}}" data-textafter="{{myCtrl.textafter}}">inside</div> </body> </html>
source share