change background to views in angularjs

1

It turns out that I have a background in CSS:

body{
    background-image: url("../images/fondo_mix.png");
    background-size: cover;
    height: 100vh;
    background-attachment: fixed;
}

I use it in all views, except in two which have different backgrounds, and I need to change them, how do you suggest the change? Greetings.

    
asked by Hernan Humaña 27.12.2016 в 23:24
source

1 answer

2

with ng-style

This directive allows modifying the CSS style of a tag but defining the style as an object of the $ scope. This object will have properties whose name will be the name of the CSS style and the value of the property will be the value of the CSS style.

That is, if we create the following JavaScript object in the $ scope:

$scope.estilo={
   'background-image': 'url("../images/xxxxx.png")'
}

and an HTML tag, we put the following:

<body ng-style="estilo"></body>
    
answered by 27.12.2016 / 23:33
source