Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="//code.angularjs.org/1.3.0-beta.10/angular.min.js"></script>
  <meta charset="utf-8">
  <title>isolate $scope access 1.3.0 BETA 10</title>
</head>
<body ng-app="appli" ng-controller="ctrl">
 
  <input type="checkbox" ng-model="showDirective">SHOW</input>
  
  <directive-if show="showDirective"></directive-if>
  <directive-if-without-replace show="showDirective"></directive-if-without-replace>
  <directive-show show="showDirective"></directive-show>
  
</body>
</html>
 
angular.module('appli',[])
.controller('ctrl',function($scope){
  $scope.showDirective=true;
})
.controller('directiveCtrl',function($scope){
   $scope.msgSetInDirective='OK';
})
.directive('directiveIf',function(){
  return {
    template:'<div ng-if="show"> '+
    ' directiveIf: {{ msgSetInDirective }}'+
    '</div>',
    scope: {
      show: '=',
    },
    controller:'directiveCtrl',
    replace: true,
    restrict: 'E'
  };
})
.directive('directiveIfWithoutReplace',function(){
  return {
    template:'<div ng-if="show"> '+
    'directiveIfWithoutReplace: {{ msgSetInDirective }}'+
    '</div>',
    scope: {
      show: '=',
    },
    controller:'directiveCtrl',
    restrict: 'E'
  };
})
.directive('directiveShow',function(){
  return {
    template:'<div ng-show="show"> '+
    'directiveShow: {{ msgSetInDirective }}'+
    '</div>',
    scope: {
      show: '=',
    },
    controller:'directiveCtrl',
    replace: true,
    restrict: 'E'
  };
});
Output

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

Dismiss x
public
Bin info
bertrandgressierpro
0viewers