0

This is my Editor input tag:

<textarea cols="18" rows="40" class="wysihtml5 wysihtml5-min form-control" ng-model="TemplateDescription"></textarea>

When binding my $scope variable with ng-model then it returns undefined. and when I bind my $scope variable with ng-bind-html then still the same result. So then I gave an Id to this textarea and accessed the value inside of it by using this statement.

$scope.TemplateDescription = $sce.trustAsHtml($("#templateDescription").val());

I get the values as shown in the image below, so how can I get my required html text in my modal so that I can pass this value to save into database. Any kind of help will be appreciated. enter image description here

2
  • Can u tell me if your TemplateDescription variable will contain simple text or raw html ? because you have used $sce.trustAsHtml(). Commented Aug 15, 2016 at 6:29
  • it is containing raw html Commented Aug 15, 2016 at 6:32

1 Answer 1

1

If your TemplateDescription variable is containing raw HTML then you can try something like this.

First you need to set your raw HTML as trusted.

$scope.TemplateDescription = $sce.trustAsHtml($scope.TemplateDescription);

And then you need to bind TemplateDescription using ng-model

<textarea cols="18" rows="40" class="wysihtml5 wysihtml5-min form-control" ng-model="TemplateDescription"></textarea>

I have tested it. It will work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.