Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Hopefully this saves clone">
<script src="https://code.jquery.com/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body ng-app="angularApp">
  <div ng-controller="AppController">
    
    <ul class="nav nav-pills">
      <li role="presentation" ng-repeat="menuItems in dataJson" ng-click="show(menuItems)"><a href>{{menuItems.name}}</a></li>
    </ul>
    <div class="row">
      
     <div class="col-md-12" ng-repeat="pages in dataJson">
        <h3 ng-show="pages.visible">
          {{pages.name}}
        </h3>
      </div>
      
    </div>
  
  </div>
  
  
</body>
</html>
 
var app = angular.module('angularApp',[]);
app.controller('AppController',['$scope',function($scope){
  
//   console.log($scope);
  
  
  $scope.show = function(menu){
    console.log(menu);
    
    angular.forEach($scope.dataJson, function(value) {
     if(value.id === menu.id){
       menu.visible =  true;
     }else{
       value.visible = false;
     }
    });
    
  };
  
  $scope.dataJson =[
  {
    "id":1,
    "name":"Home",
    "visible":true
  },
  {
    "id":2,
    "name":"Profile",
    "visible":false
  },
  {
    "id":3,
    "name":"Messages",
    "visible":false
  }
  ];
  
  $scope.buttons =[
    {
      
    }
  ];
  
  $('.nav li').click(function(){
    $('.nav li').removeClass('active');
    $(this).addClass('active');
  });
  
  
}]);
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
moehammoudpro
0viewers