Ok. I've googled the possibility of doing this without any luck.
Here's my scenario:
I'm trying to show a spinner for any value waiting on a promise to resolve, but I want to use a filter to achieve this without using the ng-bind-html
directive, since most of my binding is already done using the curly braces expression syntax: {{myvalue}}
. I just want to add a filter wherever I need this behaviour. Like this: {{myvalue | waiting}}
, so that it can be replaced whenever the promise for myvalue
resolves.
I've searched and found that you cannot output html without the ng-bing-html
directive. But I'm just checking to see if there's anyone who knows a better way to implement this, and just place the waiting
marker as an attribute/filter/css class
wherever i need this behaviour.
Filter code:
app.filter('waiting', function(){
return function(value){
return '<img src="loading.png"/>';
}
});
Sample HTML:
<div ng-controller='ControllerThatHoldsPromise'> <!-- :) -->
<span>{{myvalue | waiting}}</span>
</div>
Summarily, my objective is to output html without ng-bind-html. Thanks
::before
or::after
to achieve this effect, but it will just requireng-class
instead. – Erik Lundgren Aug 6 at 11:38