angularjsangular-ui-tree

Adding labels to the trees in angular-ui-tree


Is there a way to add labels or separate trees to the angular-ui-tree?

I have a JSON file with questions that I'm feeding the $scope.tree to display in my front end. I would like to have a separate tree to get the answers to those questions.

Is this possible?

I have included a picture of what I'm trying to accomplish.

enter image description here


Solution

  • Use a separate model for both:

    For the question, use:

    <label for="categoryName">{{node.nodes.length}} {{$index + 1 + "-"}} {{node.title}}</label>
    

    And for the answer, use:

    <input type="text" class="form-control" placeholder="Answer" id="categoryName" ng-model="node.answer">