ngtemplate-loader icon indicating copy to clipboard operation
ngtemplate-loader copied to clipboard

Raw html

Open du5rte opened this issue 10 years ago • 4 comments

Hi, would it be possible to pass raw html instead of a url to use with template: instead of templateUrl:

For a use case similar to this:

app.config(function($stateProvider) {
  $stateProvider
    .state('root', {
      url: '/',
      template: require('./components/root.jade')
    });
});
loaders: [
    { test: /\.html$/, loader: 'ngtemplate?raw!html' },
    { test: /\.jade$/, loader: 'ngtemplate?raw!html!jade-html' }
]

du5rte avatar Sep 25 '15 18:09 du5rte

If you want an inline template string than you don't need this plugin, as its purpose is to populate $templateCache which is used by templateUrl. Adding something like this - at the top of your file, as the readme points out - would probably work, and you just need jade-html-loader.

var template = require('./components/root.jade')

ratbeard avatar Sep 30 '15 14:09 ratbeard

It would definitely be a nice thing to have. My use case: I want to be able to use both, raw html imports and templateCache.

I tried to refactor an app to use just raw html, but things like dynamic ng-include won't work. So I was thinking on doing templateCache + raw.

deini avatar Mar 22 '16 16:03 deini

it can be implemented introducing a breaking change like the generated module export an object with url and content, not just an url.

e-cloud avatar Jun 14 '16 07:06 e-cloud

var templateUrl = require('raw-loader!./mydirective.template.html'); {... template: templateUrl,

ghuser avatar Feb 22 '18 17:02 ghuser