question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Interpolated templateUrl

See original GitHub issue

Hi! Is there a way for me to interpolate on templateUrl attribute?

Example: HTML <ng-pdf template-url="{{vm.templateUrl}}" test debug="false" scale="1.6" pdfurl="vm.pdfUrl" canvasid="pdf-canvas"></ng-pdf>

JS ` var vm = this;

vm.templateUrl = ‘/app/views/pdf-control.html?v=’ + version; `

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:9

github_iconTop GitHub Comments

1reaction
DanLatimercommented, May 16, 2017

Did anyone find a solution to this issue? I’m having the same problem. template-url seems to always be taken as a string literal

0reactions
naganocommented, Jun 18, 2018

If anyone is still interested in this, you have to force a compilation using $compile or compile function in your directive, in order to turn template-url dynamic.

In my case it was being called inside another directive.

return {
    restrict: 'E',
    ,link: function(scope, element){
        const template = '<ng-pdf template-url="' + URL + '" canvasid="pdf"></ng-pdf>';
        element.append($compile(template)(scope));
    }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

dynamic templateUrl in directive based on element attribute ...
The template that always get returned is template-other.html because the type value was still {{widget.type}} and has not been interpolated yet.
Read more >
Angular template syntax - Agiliq
... Example Angular Component we have used a HTML template templateUrl: '. ... Interpolation is a double braced syntax to render data in...
Read more >
Component - Angular
templateUrl ? The relative path or absolute URL of a template file for an Angular component. If provided, do not supply an inline...
Read more >
Angular2: method used in interpolation in external template is ...
Angular2: method used in interpolation in external template is marked as unused. 7. Is duplicated by 5. Is duplicated by 5 issues (0...
Read more >
Angular 7 - template & templateUrl - Sahosoft Tutorials
If you use single or double quotes instead of backticks, an error will occur. template: “<h1>{{interpolation}}</ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found