0

I need to add a fullscreen CSS background to a single view in my app. I tried to achieve this by adding a class to the body however this remains in the cache and remains on the body when switching view.

I'm having this issue because my <div ng-view=""></div> is within the <body> so I cannot easily add a fullscreen BG from within the view.

2
  • Possible duplicate of Changing body background color with angularjs. Commented Oct 18, 2015 at 20:12
  • So many ways to do this ... directive, class on template, ng-class on ng-view Commented Oct 18, 2015 at 20:19

1 Answer 1

1

For a very quick simple answer this is what I did.

applied conditional class to ng-view

index.html

ng-class="{'homebg' : home}"

style.scss

.homebg { height: 100%; background-image: url('../images/home-bg.jpg'); background-size: cover; background-position: center center; }

Controller.js

$scope.home = true;

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.