javascript - Disable tag with ng-show but not content in AngularJS -


is possible "disable" tag instead of completly hiding content? want enclose content pre-tag if boolean true. ng-show hides complete tag content if boolean false, want remove pre-tag keep content. possible?

my current solution using custom filter, in opinion more hack solution.

angular.module("myapp", []).filter("mytext", function () {     return function (message)     {         message.text = message.text.trim();          if (message.flag)         {             message.text = "<pre>" + message.text + "</pre>";         }          return message.text;     }; }); 

using filter seems quite appropriate honest.

you can hack html this:

<span ng-hide="message.flag"><pre></span>{{message}}<span ng-hide="message.flg"></pre></span> 

the w3 validator seems down can't verify valid html if is, wouldn't use solution :)


Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -