1 import * as angular from 'angularAMD';
3 export interface Node {
15 const help = angular.module('app.help');
17 // class HelpTreeController implements ng.IController {
18 // constructor(private $scope: ng.IScope & { rootNode: Node, data: Node[]}) {
19 // $scope.$watch("rootNode", (n, o) => {
20 // $scope.data = Object.keys($scope.rootNode).map(key => $scope.rootNode[key]);
25 // help.controller("treeCtrl", ["$scope", HelpTreeController]);
27 const helpTree = function ($compile) {
31 scope: { rootNode: '=' },
32 //controller: 'treeCtrl',
35 '<li ng-transclude></li>' +
36 '<li ng-repeat="child in rootNode.nodes">' +
37 '<tree root-node="child"><div ng-transclude></div></tree>' +
40 compile: function (tElement, tAttr, transclude) {
41 var contents = tElement.contents().remove();
43 return function (scope, iElement, iAttr) {
44 if (!compiledContents) {
45 compiledContents = $compile(contents, transclude);
47 compiledContents(scope, function (clone, scope) {
48 iElement.append(clone);
55 help.directive("tree", ["$compile", helpTree]);