Allow default for @Component metadata for Angular 2

Downloads in past


1531.0.136 years ago7 years agoMinified + gzip package size for @angularclass/conventions-loader in KB


<img width="438" alt="Angular 2 Fundamentals" src="https://cloud.githubusercontent.com/assets/1016365/17200649/085798c6-543c-11e6-8ad0-2484f0641624.png">

Angular 2 Conventions Loader
Allow defaults for @Component metadata for Angular 2
npm install @angularclass/conventions-loader --save-dev loader options
// default values
selectorPrefix = '';
cssExtension   = '.css';
htmlExtension  = '.html';
'-component' is removed from selector generated by className

  test: /\.ts$/,
  loaders: [

Given this simple Component example app.js
export class App {
Webpack will change the code app.js
  selector: "app",
  styles: [require("./app.css")],
  template: require("./app.html")
export class App {
this is assuming you have corresponding files next to the component. You may overwrite the selector at anytime by providing one. If the selector and the component file name does not match then the corresponding css/template file with the selector will be injected.


Sean Larkin
from the Webpack team TheLarkInn/angular2-template-loader

enjoy — AngularClass



Learn AngularJS, Angular 2, and Modern Web Development from the best. Looking for corporate Angular training, want to host us, or Angular consulting? patrick@angularclass.com