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.

Replace templateUrl with template in /extensions

See original GitHub issue

Replace templateUrl: UrlInterpolationService.getDirectiveTemplateUrl('somePath') with template: require(somePath) and use webpack for inserting the HTML templates into the generated bundles. This will improve latency and bandwidth of the directives loading since Angular doesn’t need to retrieve the HTML via AJAX request.

Work to be done:

Steps:

  1. Replace the templateUrl: UrlInterpolationService.someFunction('someUrl') with template: require('someUrl') in one of the extensions subfolder (example: https://github.com/oppia/oppia/pull/8503/files#diff-0969d47989e137044b352fbefd9e6476)
  2. If UrlInterpolationService is not needed in the directive anymore remove it. Also remove require('domain/utilities/url-interpolation.service.ts'); from the file.

Later when the directive is migrated to Angular 8 we can replace template: require('somePath') with templateUrl: 'somePath' and use @ngtools/webpack

Resources: http://dckesler.github.io/posts/2015/05/12/angular-directives-webpack.html https://medium.com/@frosty/angularjs-template-vs-templateurl-cdde055b7907 https://antjanus.com/blog/web-development-tutorials/switching-from-angular2-template-loader-to-ngtools-webpack/

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:28 (28 by maintainers)

github_iconTop GitHub Comments

1reaction
jameesjohncommented, Dec 9, 2019

This issue is currently blocked by the work on Angular 8 migration. However, once all the services have been migrated to Angular 8, we can resume working on this.

0reactions
sseth99commented, Mar 16, 2020

#7643 is this issue. I think you linked to the wrong PR @sseth99 ?

Ah, yes; I am sorry, I the PR is #8632 . As I mentioned before it makes changes to almost all the files in /extensions/rich_text_components except ‘/extensions/rich_text_components/Video/directives/oppia-noninteractive-video.directive.ts’ ; so I’ll be working on this one, right?

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Blocked on #8472] Replace templateUrl with template #8630
Replace templateUrl : UrlInterpolationService.getDirectiveTemplateUrl('somePath') with template: require(somePath) and use webpack for ...
Read more >
path with "template":content for angular directives using gulp ...
Looking for a gulp plugin to replace "templateUrl":path with "template":content for angular directives. Templates can be large and writing all ...
Read more >
Switching from angular2-template-loader to @ngtools/webpack
First, we gotta replace the old angular2-template-loader and whatever ... Note that we're still referencing a templateUrl , not a template .
Read more >
AWS::CloudFormation::StackSet
The AWS::CloudFormation::StackSet enables you to provision stacks into AWS accounts and across Regions by using a single CloudFormation template.
Read more >
Angular directives for Bootstrap - AngularUI
template-url (Default: uib/template/carousel/slide.html ) - Add the ability to override the template used on the component. Edit in plunker.
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