Angular Add and remove Active class on click ng toggle

Also Read : first love marriage in the world

Angular Add and remove Active class on click ng toggle

Today, We want to share with you Angular Add and remove Active class on click ng toggle.
In this post we will show you How to Add and remove active class on click using AngularJS, hear for Add Class, Remove Class or Toggle Class to div using AngularJS we will give you demo and example for implement.
In this post, we will learn about Add or Remove css class to HTML element in angularJS with an example.

angular active class on click

see I have step by step explained (Add active class to an active element append class) about adding a new active class on click button and change.

READ :  Get the Http headers from current request in PHP Laravel 6

But if we need to change nav menu to remove the active class on button clicking the item again more times.
now Let us check and easy ro understand how it will work.

The web app used to app header and app footer of an application basic need are typically outside the angularjs scope of all the content or angularjs controller you are working on.
This makes active class menu and managing the navigation different state a little more to challenging.

In my apps case, to managing active class to navigation state is add class to simply applying an active class to nav menu a particular element.

READ :  Download Sample woocommerce products Data in CSV
Also Read : tamilblasters, 9kmovie, filmygod, hdhub4u, vegamovies, tamilrockers website link and 1377x proxy.

  <title>angularjs menu active class</title>

<div class="account-item">
<div class="account-heading">
<h4 class="account-title">
        <a href="#/NavMessagesDisplay"> {{ navitem }}</a>

angular active class on click File Name : app.js

var navapp = angular.module('navmenuapp', []);
navapp.controller('navmenuMainCtrl', function($scope) {
 $scope.listmenuItemsdata = ['Home','Tools','About Us','Services','Portfolio','Contact', 'Products', 'Other','Download'];
$scope.navmenuactiveMenu = $scope.listmenuItemsdata[0];
   $scope.navsetActivemenu = function(navmenuItemname) {
    $scope.navmenuactiveMenu = navmenuItemname


/* include or Put your css in here style.css file */

.active {
  background : red;

Alternate Way Simple – angular active class on click

A very Simple and elegant – esay way is to use angularjs ng-controller to run a single controller used to outside of the ng-view data changes:

<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
		//List of Navigation menu in li html tag
<li><a href="/">Home</a></li>
<li><a href="/AboutUs">AboutUs</a></li>
<li><a href="/Services">Services</a></li>
<li><a href="/PORTFOLIO">PORTFOLIO</a></li>
<li><a href="/Products">Products</a></li>
<li><a href="/Career">Career</a></li>
<li><a href="/Contact">Contact</a></li>
<li><a href="/Tools">Tools</a></li>
<li><a href="/Privacy">Privacy</a></li>
<li><a href="/Terms">Terms</a></li>

and specific path to include in controllers.js:


function NavHeaderMenuController($scope, $location) 
    $scope.navisActiveMenu = function (setviewLocationname) { 
        return setviewLocationname === $location.path();