angularJS parentNode of directive is null -
i have defined directive, , specified template , added compile function. below
mainapp.directive("myspan", function () { return { restrict: 'e', template: '<span style=\"background-color:gray;color:orange\">pppdsf</span>', replace: true, require:'^uiscroll', compile: function (template, attrs) { return { post:function (scope, element, attrs, scrollcontroller) { var pp = 1; } } } } });
but there error can't find scrollcontroller. reason template[0].parentnode.parentnode
null
, not find parentnode's controller property. has encountered error before?
<div ng-controller="maincontroller mainctr"> <ul class="dataarea"> <li ui-scroll="item in suggestionlist.datasource" buffer-size="10"> <my-span></my-span> </li> </ul> </div>
Comments
Post a Comment