import {Component} from 'angular2/core'; @Component({ selector: 'app', styleUrls: ['./app.component.less'], templateUrl: './app.component.html' }) export class AppComponent { name:string = 'Demo' }
When using the relative path for templateUrl and styleUrls, I get: 404 error, file not found:
zone.js: 101 GET http: //localhost/app.component.html 404 (not found)
code: https://github.com/Dreampie/angular2-demo
I think this is not a very good design, because under different circumstances the catalog assembly may not be the same, can I change it to the relative current path?
raw-loader can resolve this, but html-loader , less-loader does not work for template , styles , it only works in string , so why not support them?
import {Component} from 'angular2/core'; @Component({ selector: 'app', styles: [require('./app.component.less')], template: require('./app.component.html') }) export class AppComponent { name:string = 'Demo' }
get another error:
browser_adapter.js:77 EXCEPTION: Error during instantiation of Token Promise<ComponentRef>!.BrowserDomAdapter.logError browser_adapter.js:77 ORIGINAL EXCEPTION: Expected 'styles' to be an array of strings.
source share