I want to create my own treeview directive but i get this error:
TypeError: undefined is not a function
the codes is here.
and my directive codes is :
app.directive('tree', [function () {
return {
scope:{
treeModel:'='
},
restrict: 'AE',
template:'<ul><li ng-repeat="root in treeModel">{{root.name}}'+
'<ul><li ng-repeat="h in root.hierarchies"><hierarchey hierarchey- model="h"></hierarchey></li></ul>'
+'</li><ul>'
};
}]);
app.directive('hierarchey', [function () {
return {
scope:{
isExpand:false
},
controller:function($scope){
$scope.hierarchyOp = function(){
alert("IM CLIKED");
}
},
restrict: 'AE',
template:'<span ng-click="hierarchyOp()"><i ng-show="isExpand" class="fa fa-folder-open"></i><i ng-hide="isExpand" class="fa fa-folder-open"></i>{{h.name}}</span>'
};
}])