0

I'm trying to paste list of values to text area with using textAngular directive and faced with the problem, that I cannot do that. For some reason it shows me just brackets without any errors in console.

The only one way how I can paste data to textAngular is provide path such as:

comparesing[0].description directly in ng-model of textAngular, but I need to display list of values. So could anybody help me to find my mistake? thanks in advance.

This is my code:

 angular.module("textAngularTest", ['textAngular'])
    .controller('wysiwygeditor', ['$scope', 'textAngularManager', function wysiwygeditor($scope, textAngularManager) {
        (function () {

          $scope.data = '[{"id":11820,"occuredDate":"2016-10-26T18:23:01.000Z","title":"Log In","description":"User 123-001 logged in"},{"id":11819,"occuredDate":"2016-10-19T18:32:07.000Z","title":"Log out","description":"User has logged off"}]'

          $scope.comparesing = JSON.parse($scope.data)

          $scope.orightml = '<ol ng-repeat="(key, value) in comparesing"><li>{{value.description}}</li></ol>';
        }());
    }]);

html

       <div text-angular name="Narrate items" ng-model="orightml"></div>

this is plunker with my error

antonyboom
  • 1,161
  • 2
  • 17
  • 44
  • textAngular doesn't parse the **data** stored in `ng-model` and evaluate it as **code**; what you are trying to do isn't possible with this plugin, as far as I know. – Claies Nov 01 '16 at 22:01
  • @Claies yes it does the parsing. I tried `$scope.orightml = "
    1. abc
    2. def
    ";` and it parsed it
    – Ahmad hamza Nov 01 '16 at 22:07
  • explained another way: you can't have a model (`comparesing`) defined inside another model (`orightml`). What you pasted in the comments is plain HTML, not angular expressions. – Claies Nov 01 '16 at 22:07
  • @Claies so Is there any way to parse, list of values to text area? – antonyboom Nov 01 '16 at 22:10
  • @Claies You're right. – Ahmad hamza Nov 01 '16 at 22:12
  • you could build an HTML string in the controller by using `$compile`, but the resultant string will be static HTML with no contextual binding back to the object it was built from; changes in the text window won't change the underlying object, or the server side data. This isn't a plugin that can be used as a data mill. – Claies Nov 01 '16 at 22:17

0 Answers0