Image 角度2 aot构建-需要问题

Image 角度2 aot构建-需要问题,image,angular,typescript,angular-cli,Image,Angular,Typescript,Angular Cli,通过angular cli构建应用程序aot时 i、 e.(ng构建--aot--prod) 我收到以下错误: ..app>ng build --prod --aot 10% building modules 2/2 modules 0 active Error encountered resolving symbol values statically. Calling function 'require', function calls are not supported. Cons

通过angular cli构建应用程序aot时

i、 e.(ng构建--aot--prod)

我收到以下错误:

..app>ng build --prod --aot
10% building modules 2/2 modules 0 active Error encountered 
resolving symbol values statically. Calling function 'require',
function calls are not supported. Consider replacing the function
or lambda with a reference to an exported function, resolving symbol
appComponent in ..app.component.ts, resolving symbol AppComponent 
in ..app.component.ts
我的组件看起来像:

@Component({
selector: 'app-component',
template: `
 ...
<div class="centered">
    <img [src]="logo">
</div>
....
`,
styles: [require('./app-component.component.css')]
})

export class LoginComponent {

private logo = require('./logo.png');
...
}
@组件({
选择器:“应用程序组件”,
模板:`
...
....
`,
样式:[需要('./app-component.component.css')]
})
导出类登录组件{
私有logo=require('./logo.png');
...
}

有什么解决方法吗?

我认为AOT编译不允许使用require语句。无论如何,它们都是不必要的。

进行此更改,使路径绝对指向应用程序根目录

组件的模板:

<div class="centered">
    <img src="{{logo}}">
</div>

函数调用不受支持,请添加对函数的引用。能否提供一个代码段?我尝试创建一个新组件,并执行如下操作:export var logo=require('./logo.png');但它也不起作用。根据错误日志,它们确实是不被允许的。如果不需要,如何将图像绑定到img src属性?似乎根本不起作用,因为路径与基本url相关,即响应是预期的GET 404(未找到)
private logo = '/images/logo.png';