You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

angular-templatecache-loader-2

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-templatecache-loader-2

Webpack angular templateCache loader

0.3.4
latest
Source
npm
Version published
Weekly downloads
38
1166.67%
Maintainers
1
Weekly downloads
 
Created
Source

Angular templatecache webpack loader

This repo adds the

Puts HTML files to Angular $templateCache.

Features

  • You can use ng-include directives with require syntax
  • You will always have the content of the file in assigned variable

Install

You can install loader using npm:

npm i angular-templatecache-loader

Examples

main.js

var myTemplate = require('./src/myTemplate.html');  // You will have your template in myTemplate variable

index.html

<div ng-include="'src/myTemplate.html'"></div>

Options

  • module - name of angular module (default is ng)
  {
    test: /\.html$/,
    loader: "angular-templatecache-loader?module=app"
  }
  • prefix - add prefix to all file names
  {
    test: /\.html$/,
    loader: "angular-templatecache-loader?prefix=/public/src"
  }
  • relativeTo - remove a string from the path

relativeTo is used to strip a matching prefix from the path of the input html file.

  {
    test: /\.html$/,
    loader: "angular-templatecache-loader?relativeTo=/public/"
  }

The above will remove the "/public/" from the generated templateUrl path.

  • You can also use context in webpack to pass correct template url. See Context example
var app = path.join(__dirname, 'app');

module.exports = {
  context: app
}

Keywords

angular

FAQs

Package last updated on 27 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts