angular - Angular4: Error when constructing styles array dynamically -
i using latest angular - version 4. component has code:
export function getcssurl(){ return 'http://localhost/foo/foo.css'; } @component({ selector: 'app-root', templateurl: './app.component.html', styles: ['@import "' +getcssurl()+'"'], encapsulation: viewencapsulation.none }) export class appcomponent implements oninit {}
when run ng serve, style works fine, i.e getcssurl function resolved , css loaded correctly. ng build works fine. when run ng build -prod error:
error in error encountered resolving symbol values statically. calling function 'getcssurl', function calls not supported. consider replacing function or lambda reference exported function, resolving symbol appcomponent
are able try following
styles: [getcssurl],
adding getcssurl without ()
Comments
Post a Comment