Questions tagged [angularjs-compile]

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.

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.

The compilation is a process of walking the DOM tree and matching DOM elements to directives.

Reference:
$compile

145 questions
18
votes
3 answers

Angular $compile with required controller

I have a composite list directive - that is - a list item that can be a list himself. The parent directive defines the controller: .directive('parent', function() { controller: function($scope) { }, link: function (scope, element,…
Tomer
  • 4,382
  • 5
  • 38
  • 48
15
votes
4 answers

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 are supposed to default to "(Select a ______)", which…
13
votes
1 answer

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 case: angular.module('app', []).component('app', { …
Hodes
  • 895
  • 2
  • 10
  • 18
9
votes
1 answer

Can I get the compiled html of an Angular element?

I have compiled an element using the $compile service. If I add that directly to the DOM, it looks great and all of the bindings are correct. If I want that element as a string though, it shows {{stuffHere}} instead of the bindings. Is there a…
Spencer
  • 2,245
  • 3
  • 28
  • 50
8
votes
1 answer

How $compileProvider.debugInfoEnabled set to false improve performance in angularjs 1.3?

I read the the documentation from angular website about debugInfoEnabled. Still doesn't clear with concept, how $compileProvider.debugInfoEnabled(false) inside angular config can improve the performance of application by removing the element level…
Pankaj Parkar
  • 134,766
  • 23
  • 234
  • 299
7
votes
1 answer

When using $compile on component, why is the scope passed through $parent?

I'm trying to dynamically compile an Angular component using $compile, but the scope isn't passed to the components scope, but to the $parent scope instead. Here is a simple component that binds to a myTitle-attribute and presents…
Nikolaj Dam Larsen
  • 5,455
  • 4
  • 32
  • 45
7
votes
1 answer

DOM manipulation done in compile phase runs once, and propagate always - what this means

I'm reading this article about angular performance optimization and there is the following passage there: Directive's compile functions run before scope is attached and are the perfect place to run any DOM manipulations (binding events for …
Max Koretskyi
  • 101,079
  • 60
  • 333
  • 488
7
votes
1 answer

Can AngularJS directive pick up class name from dynamic content?

http://jsfiddle.net/xKU5R/ In the above case, I'm expecting elements with cls class to be picked up with the same behavior from within ng-repeat (ng-bind-html-unsafe), and explicitly set one.
6
votes
1 answer

why ng-repeat changes order of link function execution

The usual order of execution of compile and link function on nested directives is as below Markup
Order of execution 1) compile of directive 1 2) compile of directive 2 3) link of directive 2 4) link of…
4
votes
3 answers

AngularJS ng-if not deleting element after $compile

I have a directive that does the following: Adds another directive attribute to the element. Removes its own attribute. Calls $compile() on the element to make AngularJS re-compile the element so the new directive is attached. This works fine,…
4
votes
1 answer

Prevent AngularJS from compiling contents of element

Is there a way to tell Angular to not compile contents of certain elements? Use case: Angular CMS contains textarea elements that have CKEditor attached. The CKEditor is using the divarea plugin instead of the default iframe plugin. The textareas…
Radu C
  • 1,340
  • 13
  • 31
4
votes
2 answers

Renaming 3rd party Angular Directive using $provide - not working

I've using the excellent Angular UI bootstrap in a large site alongside lots of my own directives. For the sake of neatness I looked for a way of renaming a couple of the uib directives without touching their code and came across a couple of SO…
jonhobbs
  • 26,684
  • 35
  • 115
  • 170
4
votes
1 answer

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 {{ message }}
Royi Namir
  • 144,742
  • 138
  • 468
  • 792
4
votes
2 answers

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 to show what is going on angular.module('app',…
gr3g
  • 2,866
  • 5
  • 28
  • 52
4
votes
1 answer

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: Directive usage:
Sn0opr
  • 1,016
  • 2
  • 12
  • 38
1
2 3
9 10