如何添加背景图像的角度

how to add background image in angular?

本文关键字:图像 背景 何添加 添加      更新时间:2023-09-26

你好,你能告诉我如何添加背景图像在角应该显示在整个应用程序在整个页面?

其次如何在整个页面的不同视图添加不同的背景图像…?

这是我的活塞http://plnkr.co/edit/BTl3NwEd66IMddKtPDMR?p=preview

 <div bg>
<button ng-click="goTONextpage()" >Go to next Page</button> </div>

可以在body标签中使用ng-style

<body ng-style="{'background-image':'url(yourImg.png)'}">
  ...
</body>

为不同的视图设置不同的背景:

设置变量名为image_path,不同视图的值不同

<body ng-style="image_path != '' && {'background-image':'url('+image_path+')'}" >
  ...
<body>