Hello everyone, I am going to share the code
sample for how to change body style in angularjs and all detail code as given
below.
The live demo link http://embed.plnkr.co/0AVI9E/preview
AngularJs
code sample:
var app =
angular.module('styleApp',
[]);
});
HTML
code sample:
<div ng-app="styleApp" class="my-style-calss">
<div ng-controller="styleCtrl">
change body style in angularjs
</div>
</div>
Full
Live demo code(HTML + AngularJs):
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>change body style in
angularjs</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.js"></script>
<script>
var app =
angular.module('styleApp',
[]);
app.controller('styleAppCtrl', function ($scope, $http,
$document) {
angular.element($document).find('body').removeClass('my-style-calss');
});
</script>
</head>
<body ng-app="styleApp" class="my-style-calss">
<div ng-controller="styleCtrl">
change body style in angularjs
</div>
</body>
</html>
The
output : go to link http://embed.plnkr.co/0AVI9E/preview