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

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -