Compiles an HTML string or DOM into a template and produces a template function, which can then be used to link scope and the template together.

learn more… | top users | synonyms

0
votes
0answers
18 views

Does the template function generate new child scopes?

I'm trying to replace the ng-repeat directive with a custom one written by me. Here is the definition object link function: //directive definition object... //... ///link: function ...
0
votes
0answers
22 views

AngularJS $compile and external directive ui-codemirror

I am trying to use the external module, angular-ui-codemirror, to display the $element.html() of an enclosing AngularJS directive in a code-formatted block, using nested directive ui-codemirror. If ...
0
votes
1answer
67 views

What is the best way to pass functions between inner components in AngularJS 1.5?

I was wondering what is the best way to pass functions down through 2 or more levels of components? There's no simple way of skipping the function wrap when using '&' bindings? Here's an use ...
0
votes
2answers
19 views

How to stop nested directive execution from an outer directive?

I'm creating a directive which will restrict HTML access if some condition are not met. Unfortunately issue arises when inner directives get called before inner HTML is changed and compiled. Is it ...
0
votes
1answer
40 views

i am getting issue in changing inner html of div

Guys i found a problem in changing html of div please help me document.getElementsByClassName("lab")[0].setAttribute("ng-bind-html", "binds"); $scope.binds="<h1>run</h1>"; I am setting ...
1
vote
1answer
28 views

Check if directive was already compiled

I have a directive that works on multiple tabs. It should remove itself from its initial position and append to the transcluded element. To do this, I use custom compile function, that fires once the ...
2
votes
0answers
36 views

html is not compile on append new child in angular js

I am trying to insert a node dynamically, but the appended html is not getting compiled correctly. This is the code on Fiddle. <body ng-app="app"> <div ng-controller="appController"> ...
3
votes
2answers
41 views

Dynamically add a directive

I'm generating a report with collection of questions. app.controller('reportCtrl', ['$scope','$stateParams', function ($scope, $stateParams) { $scope.questions: [ { questionkey: 1, ...
0
votes
1answer
54 views

$sce.trustAsHtml returned value not compiled by $compile

I'm trying to make a custom popover with html by using angular bootstrap-ui popover with fullcalendar's events as described here: Getting Angular UI Calendar to work with UI-Bootstrap Tooltips But I ...
2
votes
3answers
37 views

I am getting error Error: [$compile:tplrt] while using directive in angularjs

In angularJS 1.3.14 var app = angular.module('myApp',[]); app.controller('myController',['$scope',function($scope){ $scope.name = 'world'; }]); //here i created directive of name ...
0
votes
1answer
32 views

Converting angularjs menu directives to support ui.router

I found a nice hover menu implementation online. it works great for assigning hrefs. I wanted to convert it to work with ui.router states and sref. I added a href and sref value on the menu data ...
1
vote
1answer
56 views

Dynamic AngularJS directive

I'm trying to dynamically insert a ng-options directive inside <select> elements across my application, which all have their own class names and other directives (like ng-if and so). <div ...
0
votes
1answer
27 views

Angular directive stops working after being moved from one DOM element to another

I have a modal service in my app that opens/closes a modal. When the modal is opened, it plucks its content from the div with the specified id, which always sits inside a container elem that is ...
1
vote
1answer
29 views

$compile containing function as attribute value

I'm facing one issue with $compile. The code I've written is very big hence I'm create one small example to replicate this issue. Suppose I've a button in my page. When user clicks on that button, ...
0
votes
0answers
94 views

AngularJS - pre-compile ng-repeat directive template

I have a performance problem with the ng-repeat directive. It's a simple case: the first ng-repeat directive iterates over table rows, and the second one (nested) over table columns inside each row. ...
1
vote
1answer
63 views

Angularjs dynamic html string compilation with an directive included inside

I have been trying a dynamic html string parsing with recursive directives which works but two-way binding doesn't seems to be working.Need a little help here.Below is the plunker: ...
1
vote
2answers
26 views

How to get the original attribute name before it was normalized/denormalize an attribute name?

I want to create a directive that I can use on <select> elements, to tell it to populate the <select> with a globally known list that's dynamically updated and shared among all the ...
3
votes
1answer
102 views

Angular dynamic templating with compile VS template function?

I already know what is the purpose of each item in : compile vs link(pre/post) vs controller So let's say I have this simple code : HTML <body ng-controller="mainController"> {{ ...
1
vote
0answers
171 views

Extending Scope function to Directive in Angular 1.4

I am trying to extend the angular-ui.github.io/bootstrap/ datepicker and it seems not to work. angular.module('myApp', [ 'ui.bootstrap' ]) .config(function($provide) { ...
1
vote
2answers
94 views

$compile not compiling ng-href in directive

When I pass a template in an attribute, and compile it to render it afther, $compile is working fine except for ng-href="expression", where the expression isn't compiled. Is this done in the compile ...
1
vote
1answer
151 views

Use angular compileProvider outside config block

I'm trying to create directives on the fly, actually I achived that, but seams pretty hacky. This was my first approach: function create(myDir) { angular.module("app").directive(myDir.name, ...
0
votes
1answer
149 views

Angular object undefined after compiled in html string pass to another Directive

I am doing something like this in Angular. After compiled, the object will not be passed to the DirectiveB correctly. However, if I passed the object defined in scope, it will be fine. I wonder why ...
1
vote
1answer
178 views

Add angularjs directive to a native html element (input text, div, span etc)?

I have something like this - <input type="text" value="" title="Title"> ... How can I add my custom directive as attribute to the existing html element on the page, let's say - directive as ...
0
votes
2answers
211 views

AngularJS: Why can't I add an attribute to grandparent element when parent has ngIf directive

I'm using vanilla AngularJS v1.4.5 (no jQuery) and would like my custom directive to add an attribute to its grandparent element at compile time. In the compile function, I can achieve this using the ...
0
votes
0answers
28 views

Using $compile function in AngularJS

I am new to AngularJS, I am working on a calendar directive, understanding and modifying this code calendar fiddle, this is the static one showing only present month with highlighted date, but I want ...
1
vote
1answer
233 views

ng-click fired multiple times after compile

I have read many SO answer but couldn't resolve the problem. I have a Javascript function that create HTML element like document.createElement(...) This is a part of that function : var ...
0
votes
1answer
60 views

pass scope function to cloned(and compiled) angular directive

I have an angular directive, which can take a parent controller function as attribute. During DOM manipulation, this angular directive is cloned, compiled and placed into the beginning part of the ...
0
votes
0answers
57 views

Active angularjs directives inside a WYSIWYG editor

My objective is to have a WYSIWYG html editor cum preview with active AngularJS directives in it. I have been trying to achieve this with textAngular and $compile. I found this stackoverflow question ...
1
vote
1answer
80 views

Angular composite (super) directive not allowing 2 way binding on component (child) directives

I have a need to create a composite directive that incorporates separate fully functional directives. One of my component directives adds an element to the dom and that element binds to a value in ...
0
votes
0answers
18 views

Angular Compiler element is binding data one less than the instantiated elements of link function

<div demo-greet ng-repeat="i in [1,2,3]"></div> app.directive('demoGreet', function() { return { compile: function(tElement, tAttrs) { console.log('compile fn', ...
4
votes
2answers
80 views

Directive priority with event listener

I have one input element with 2 directives: -direc (priority level 1) -directive (priority level 0) even if direc is supposed to execute first, directive is executing first. Why? Here is a snippet ...
0
votes
2answers
121 views

How to $compile angular template to make it work in multiple controllers with aliases?

I have a custom directive that simply $compiles a template into another. .directive('staticInclude', function($http, $templateCache, $compile) { return function(scope, element, attrs) { ...
2
votes
1answer
81 views

google maps when i click arrow icon in google map [$parse:syntax] error?

.controller('MapCtrl', [ '$scope', '$http', '$location', '$window', function ($scope, $http, $location, $window) { $http.get('****').success(function (data, dealers, response) { ...
0
votes
0answers
44 views

Change Template of a 3rd Party AngularJS App

I am a AngularJS beginner and I want to change the template of a 3rd party AngularJS app. The template was stored in a variable and compiled.See below: return { restrict: 'EA', ...
1
vote
1answer
76 views

AngularJS : invoking optional nested directive on template sub-element

I'm trying to write a directive that emits all of the HTML for a field in a form - the wrapping div, label, input, etc. For some fields I want to use Angular UI Bootstrap's "typeahead" directive. I ...
0
votes
1answer
156 views

How would I render html tags inserted via compile in AngularJS?

I am creating a UI that would allow a user to create preview html content. For the purposes of this question, lets say I have the following array of objects: modules = [ { id: 0, ...
2
votes
4answers
818 views

AngularJS: Cannot interpolate attribute from first directive to a second. (w/ plunker example)

Reference Reference plunker: http://plnkr.co/edit/otv5mVVQ36iPi3Mp0FYw?p=preview Explanation of the issue Suppose that we have two directives, first-directive and second-directive. Now suppose we ...
0
votes
1answer
157 views

KendoUI Popover $compile issue

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 ...
1
vote
1answer
455 views

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

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 ...
5
votes
3answers
2k views

AngularJS 1.4: Select List Value not Initializing Correctly when List is Inserted with $compile

Here's some quick background info. I just upgraded to Angular 1.4. I'm using an API written in C# for my server-side calls. A section of my page shows 2 select lists (Project & Sub-project). Both ...
1
vote
1answer
387 views

How to add attributes to child element in directive

I have the following plunkr: http://plnkr.co/edit/M1uwZxZP7sXp5sPw7pxf?p=preview What I want to do is: I'd like to build an angular code to generate inputs automatically inside a form, given a json ...
0
votes
1answer
68 views

Transclude does not interpolate

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)"> ...
0
votes
2answers
842 views

angularjs partial view with controller(javascript)

following code create error like this Uncaught Error: [ng:areq] http://errors.angularjs.org/1.3.15/ng/areq?p0=subCtrl&p1=not%20a%20function%2C%20got%20undefined how can i fix it? sample ...
2
votes
1answer
1k views

AngularJS: Get html content of a directive before 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> ...
1
vote
1answer
85 views

Compile a directive with templateUrl into string and wait for delayed link function

I want to $compile a piece of html that contains several directives into a string and send this to the server. Since some directives contain a templateUrl, the returned link function is delayed. In ...
2
votes
2answers
238 views

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

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 ...
0
votes
0answers
47 views

Binding HTML template to data in AngularJS

I have a simple HTML template like following <p>{{data.id}}</p> And can I just compile it with a data object to a string, I do not want to bind it with any scope. Like var data = ...
0
votes
1answer
35 views

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

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 ...
1
vote
2answers
110 views

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

I am new with AngularJs and I got trouble in the following code. return { require: ['^myElement'], restrict: 'EA', replace: true, scope: true, link: function ...
0
votes
2answers
273 views

AngularJS : Why can't $interpolate render ng-style?

I have created a drop down input directive, where the user can pass in a template string to set what the list will actually render. In my example I am passing in <div style="background-color: ...