javascript - angularjs - get ng-repeat element using element.html() inside a jsPanel directive -
i trying create directive take html content , place n jspanel element.
so far able compile scope , able elements scope. tried html tag ng-repeat, got stuck.
following code used create directive
mainapp.directive('jspanelcontent', function($compile) { console.log("loading"); var directive = {}; directive.restrict = 'ae'; directive.compile = function(element, attributes) { var linkfunction = function($scope, element, attributes) { console.log(element.html()); var contenthtml = element.html(); contenthtml = angular.element($compile(contenthtml)($scope)); element.html(""); $scope.jspanleinstance = $.jspanel({ position: { my: "left-bottom", at: "left-bottom", offsety: 15 }, theme: "rebeccapurple", contentsize: { width: 600, height: 350 }, headertitle: attributes.panelcaption, content: contenthtml, }); // }); } return linkfunction; } return directive; });
, using following in html
<div jspanelcontent panelcaption="list"> <div ng-controller="listcontroller"> {{test}} <div ng-repeat="user in users"> <span><a href="{{user.id}}">{{user.id}}</a></span> <span>{{user.name}}</span> <span>{{user.email}}</span> <br /> </div> </div>
the console log returns as
output getting (jspanel)
as see "test" variable bind , ng-repeat element display commented, not aware why it's returning that. if can figure out issue, might working.
i know can access users data $scope.users inside directive. problem here user able use directive commonly, have assume don't variables in $scope.
stuck in place, , couldn't find solutions try. suggestions or solutions more helpful. :)
note: no syntax errors, outside directive data displaying (tested)
Comments
Post a Comment