Y K
Y K

Reputation: 81

manipulating content with ng-bind-html and default content

I'm trying to use angular to reload (or 'livechange') content - the content default structure isn't created by angular. so i have the following

<div>Default Value</div>

and i want to be able to rebuild the content with angular (ng-bind-html is a great solution, but it cant use 'default' value).

Any help would be appreciated. thanks!

Upvotes: 1

Views: 260

Answers (1)

sylwester
sylwester

Reputation: 16498

You can do that using ng-hide/ng-show directive please see here http://plnkr.co/edit/oHJMD6UU3xOOg5HZo3IC?p=preview

<body ng-controller="MainCtrl">

  <textarea name="comment" ng-model="myHTML"></textarea>
  <div ng-bind-html="myHTML" ng-show="myHTML"></div>
  <div ng-hide="myHTML">Default Value</div>
</body>

Upvotes: 1

Related Questions