Reputation: 164
Using jQuery
$(document).ready(function() {
$("#pid1").removeClass("login_page");
});
HTML
<body class="login_page" id="pid1" ng-app="myApp" ng-controller="myCtrl">
In the main page class gets removed but login page also remove class but I have to keep the class in the login page.
loginpage.html
<div class="login_page">
</div>
when I add remove class function it's work and I have tried to keep the login_page class in loginpage.html.
Upvotes: 0
Views: 1310
Reputation: 164
I solved this issue and its' work for me,
add and remove class manually in index controller and login controller, I remove class function in the index page and added class function in the login page.
Remove function
$(document).ready(function()
{
$("body").removeClass("login_page");
});
Add function
$(document).ready(function()
{
$("body").addClass("login_page");
});
Upvotes: 0
Reputation: 131
The simple solution for this is below which will remove the body class on load.
window.onload = function () { document.body.className = ""; }
If you do have concern with other lib then you can try below solution as well.
window.addEventListener(
'load',
function load()
{
window.removeEventListener('load', load, false);
document.body.classList.remove('preload');
},
false
);
Using addEventListener means that it won't interfere with any other event listeners that may be attached by other libs, etc.
The above code will remove the event listener once the event has fired too.
Upvotes: 1
Reputation: 6797
This will work for you:
In below code .login_page_class
can be your class which is present only in your login page.
$(document).ready(function() {
if($(".login_page_class").length == 0){
$("#pid1").removeClass("login_page");
};
});
Added a condition to check if .login_page
is present in the page and if it is then don't execute the code.
Hope this was helpful for you.
Upvotes: 1