AngularJS Add ng class to toggle Active Menu

AngularJS Add ng class to toggle Active Menu

In this Post We Will Explain About is AngularJS Add ng class to toggle Active Menu With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Angular: Toggle a Class on Click Example

In this post we will show you Best way to implement angularjs – How to set active class on ng-click, hear for How to add class active to a menu with AngularJS with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Read Also:  Create Dynamic hide and show Tabs content in Angularjs

Angular js add class to active element

In this Example,First of all Add or Inluce External Libs Like as a(jQuery, css etc..), and then create a simple index.php or index.html page.After that crate a simple javascript file like as a index.js or main.js, It is also add your web-application First Header Part to some priorty set.After that Include your relavant CSS Class.</p

Here We Are going to learn how to add active class HTML Menu on dynamically added content or simple a href link while on clicking. We have explained simple same using Angular 2 as well as 4 concept as well all the angular4 check this link for that.

Read Also:  PHP Laravel pagination Code Examples

index.html

<div>
    <div>
 
 <ul>
 <li class="livepagClass">
 <div>{{ studentList.name }} </div> 
 </li>
</ul> 
    </div>
</div>

index.js

var myapp = angular.module('sampleapp', [ ]);

myapp.controller('liveCtrl', function ($scope) {

  
 $scope.DisplayData = function( ){

 
     $scope.datalists = [
    { "name": "Read about ankit Kathiriya"},
    {"name": "Read about Jaydeep Gondaliya"},
    {"name": "Read about Ravi Dhameliya"},
    {"name": "Read about Jignesh Vadodariya"},
    {"name": "Read about Thuumar Dhara"}
    
]
}
 $scope.select= function(item) {
	       $scope.selected = item; 
	};
$scope.getClickActive = function(item) {
	       return $scope.selected === item;
	};
	
});

style.css

.livepagClass{
    
margin: 19px 28px;    
}
.livepagClass div{
    cursor:pointer;
    text-decoration:underline;
}
.active{
    color:red;
}

You are Most welcome in my youtube Channel Please shubscibe my channel. and give me feedBackMore Details……
Angularjs Example

Example

I hope you have Got What is Angular js add class to active element And how it works.I would Like to have FeaeBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments abaout This Article(Pakainfo.com) Are Most Always Welcome.