Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html ng-app="myApp" ng-controller="AppCtrl">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  <h1 ng-show2="show" >{{name}}</h1>
</body>
  
</html>
 
var app = angular.module('myApp', []);
  app.controller('AppCtrl', function AppCtrl($scope){
    $scope.name = 'Anna';
    $scope.show = true;
  });
  //建立一個名稱為ngShow2的directive,
  app.directive('ngShow2', function(){
    return{ 
      replace: true,
      restrict: 'A',
      link: function($scope, $element, $attributes){
      var expr = $attributes.ngShow2;   
      $element.css('color', $scope[expr] ? 'blue' : '');
      }
    };
  });
Output 300px

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

Dismiss x
public
Bin info
annaismepro
0viewers