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

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -