bootstrap popover - ng-repeat within pop-over angular directive -
i trying use boot-strap pop-over within angular. have created directive & trying attach content dynamically using $compile. $compile not replacing contents. here fiddle.
http://jsfiddle.net/gurukashyap/4ajpyjyf/
customdirectives = angular.module('customdirectives', []); function myctrl($scope) { $scope.items = ['abc','dev','it']; } customdirectives.directive('custpopover', function ($compile) { return { scope : { items : '=items' }, restrict: 'a', template: '<span>label</span>', link: function (scope, el, attrs) { scope.label = attrs.popoverlabel; var temp = '<ul><li ng-repeat="item in items">{{item}}</li></ul>'; var contents = $compile(temp)(scope); console.log(scope); $(el).popover({ trigger: 'click', html: true, content: contents, placement: attrs.popoverplacement }); } }; }); angular.module('customcomponents', ['customdirectives']); any appreicated
you passed parameter wrong. items: '=newvar'
Comments
Post a Comment