1

I'm trying to load html partials in to my angular app using ngtempalte-loader I can't figure out how to only include a certain folder.

Lets say my tree structure is as so:

-root/
     -webpack.config.js
     -app/
        -templates/
           -template1/
               -file.html  
           -template2/

And I'm using this in the config file for webpack:

{
   test: /\.html$/,
   loader: 'ngtemplate?prefix=app/templates/!html'
}

I also tried with

relativeTo=

But i have no luck... It always goes through all my app and picks up all the html files. I would like to just have the partials in this folder being dealt with ngtemplate-loader. You guys know how?

1
  • Is it possible to use loader exclude option? Commented Feb 26, 2016 at 9:41

1 Answer 1

0

Not sure if this is still relevant, but you can give this a try. You require Node's 'path' module for this.

{
  test: /\.html$/,
  loader: 'ngtemplate?relativeTo=' + (path.resolve(__dirname, './app/templates')) + '/!html'
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.