Angular 2 Conventions Loader
Allow default for @Component
metadata for Angular 2
npm install @angularclass/conventions-loader --save-dev
{
test: /\.ts$/,
loaders: [
'ts-loader',
'@angularclass/conventions-loader'
]
},
Given this simple Component example
app.js
@Component({})
export class App {
}
Webpack will change the code
app.js
@Component({
selector: "app",
styles: [require("./app.css")],
template: require("./app.html")
})
export class App {
}
this is assuming you have coresponding 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 coresponding css/template file with the selector will be injected.
enjoy — AngularClass
##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
Apache-2.0