FAQ Database Discussion Community


unable to form the view using ng-repeat through custom directive template compilation

angularjs,angularjs-ng-repeat,angularjs-compile,angularjs-templates
I am facing problem in representing ng-repeat in template for custom directive compilation. Please find my plunker http://plnkr.co/edit/5A5oZf5kwBezB4mqZ56C?p=preview. Here even though the question is appearing but the options are not appearing. I am doubting whether my following code in the template formation is correct or not? <div ng-repeat="Option in {{curQuestion.Options}}">...

Transclude does not interpolate

angularjs,angularjs-directive,transclusion,angularjs-compile,angularjs-ng-transclude
I have a directive that transcludes some HTML to provide a faux context menu. The usage is as such: <div id="my-element"> My content <context-menu get-offset="getOffset($event)"> <ul> <li> <a href="" ng-click="action()">{{ label }}</a> </li> </ul> </context-menu> </div> This will bind an event listener to #my-element which on right click will show...

KendoUI Popover $compile issue

angularjs,angularjs-directive,kendo-ui,angularjs-compile,kendo-tooltip
I have directive which is a wrapper around KendoUI kendo-tooltip and I'm instantiating it like this: <div my-directive-popover="options"> </div> Inside my code I replace my-directive-popover with kendo-tooltip like this: $element.attr( 'kendo-tooltip', popoverName ); At the end of pre compile function I have to of course compile this so it's recognized...

resulting HTML from $compile(custom-directive) doesn't bind {{values}}

angularjs,angularjs-directive,angularjs-scope,mapbox,angularjs-compile
I want to dynamically add Angular custom Directives, but the directive resulting from $compile(directive) doesn't have the 2-ways binding. Here's my simplified problem: I am using MapBox, and I want to use Directives for the the markers' popup to show, for example, the markers' title. MapBox wants HTML as a...

AngularJS directives which take a template through a configuration object, and show that template multiple times

angularjs,angularjs-directive,angularjs-ng-repeat,angularjs-compile
I'm looking to create a custom directive that will take a template as a property of a configuration object, and show that template a given number of times surrounded by a header and footer. What's the best approach to create such a directive? The directive would receive the configuration object...

Failing to load html file dynamically and parsing all angularjs directives in html file

html,angularjs,controller,angularjs-compile
So I have a website set up and I wish to dynamically load other .html files into a div. Each .html file contains some content but 1 .html file contains its own angularjs directives. I was using ng-bind-html along with $scope.content = $sce.trustAsHtml(data); but I have discovered that this prints...

$compile does not apply the expression of template string on link function of directive

angularjs,angularjs-directive,angularjs-compile
I am new with AngularJs and I got trouble in the following code. return { require: ['^myElement'], restrict: 'EA', replace: true, scope: true, link: function (scope, element, attrs, ctrls) { scope.xa = 'This is xa' scope.$on('form:submit', function() { scope.xb = 'This is xb' var data = $compile( '<p>{{xa}} {{xb}}</p>' )(...

Angularjs : failing to generate c3 directive based charts dynamically

angularjs,angularjs-directive,c3.js,angularjs-compile
I am trying to create c3 charts dynamically using c3 chart directives. C3 chart directive is working fine. However dynamic chart creation upon button click is not working. Can any one suggest where I am going wrong? Please find my plunker at http://plnkr.co/edit/wWJx3zU3Sm1cN9ZCtvoh?p=preview I am compiling my c3 directive as...

Why does using $compile make factory execute multiple times

javascript,angularjs,angularjs-factory,angularjs-compile
In my code i need to compile html returned from another api from inside a javascript callback function. The following is a simplified version of my code. I am using a factory method which recomplies any element using $compile and $rootScope. The strange thing about this setup is that the...

AngularJS: Get html content of a directive before compile

javascript,angularjs,angularjs-directive,angularjs-compile
I'm creating a directive that shows a modal when user click on a button: The directive template: <button ng-click="showModal()">Show Modal</button> Directive usage: <modal-btn> <div id="modal-content"> <p>This is the modal content that I want to render in the Modal {{someModel}}</p> </div> </modal-btn> So before I compile the directive, I need to...