AngularJs- to filter or not to filter. How to print different html response property inside a loop? -
got problem i'm solving using filters, i'm sure there must clever , simpler way.
got view:
<ul id="filesview" class="filesview"> <li ng-repeat="object in folder.content.object" class="{{object.type}}"> <img src="object.thumbnails.list | thumbprinter"> {{object.name}} </li> </ul>
and filter
angular.module('appfilters', []).filter('thumbprinter', function() { if (media.type === 'file') { media.src }else{ '/images/folder.jpg' } });
and xml
<object> <type>folder</type> <name>photos</name> <complete_path>/photos</complete_path> <complete_path_hash>00e474bd8bd7deaff259</complete_path_hash> <date_created>2013-03-06 16:33:28</date_created> <date_updated>2013-03-06 16:33:28</date_updated> <deleted>false</deleted> </object>
now working. ugly, , has problems.
problems like- lets wish print img tag, if got img src, , span folder bg img. in currect senario can't.
how can inject html wish, and not strings? correct way of doing that?
thank you.
can use ng-show or ng-switch display different chunks of html based on condition?
edit: option use directive determine type of html injected.
Comments
Post a Comment