eu81273 / angular.treeview

AngularJS based Treeview (no jQuery)
MIT License
405 stars 223 forks source link

Move template string in directive to html file (enhancement) #43

Open nvernooy opened 9 years ago

nvernooy commented 9 years ago

Is it possible to move the template string used in the directive for the treeview to an external html file? I'm trying to do this myself but running into some trouble. So far I've moved the attrs variables to scope and my html looks like this:

<ul>
    <li data-ng-repeat="node in treeModel">
        <i class="collapsed"
            data-ng-show="node.nodeChildren.length && node.collapsed"
            data-ng-click="selectNodeHead(node)">
        </i>
        <i class="expanded"
            data-ng-show="node.nodeChildren.length && !node.collapsed"
            data-ng-click="selectNodeHead(node)">
        </i>
        <i class="normal"
            data-ng-hide="node.nodeChildren.length">
        </i>
        <span class="treenode node.nodeType"
            id="node.nodeId"
            data-ng-class="node.selected"
            data-ng-click="selectNodeLabel(node)">
            {{node.nodeLabel}}
        </span>
        <div data-ng-hide="!node.collapsed"
            data-tree-model="node.nodeChildren"
            data-node-id="nodeId"
            data-node-label="nodeLabel"
            data-node-children="nodeChildren"
        </div>
    </li>
</ul>

I had to take the treeId out, and the treeModel is being treated as string, I'm not sure why. Any help or comments would be appreciated.