Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <div>
    <input name="which-guy" value="drJeckyll" type="radio"> <label for="dr-jeckyll">Dr. Jeckyll</label>
  </div>
  <div>
    <input name="which-guy" value="mrHyde" type="radio"> <label for="mr-hyde">Mr. Hyde</label>
  </div>
  <template id="app-template">
    <div some-guy-in-a-suit></div>
  </template>
</body>
</html>
 
angular.module('drJeckyll', []);
angular.module('drJeckyll').directive('someGuyInASuit', function() {
  return {
    restrict: 'A',
    template: '<img src="http://www.wearysloth.com/Gallery/ActorsF/5797-26131.gif">'
  };
});
angular.module('mrHyde', []);
angular.module('mrHyde').directive('someGuyInASuit', function() {
  return {
    restrict: 'A',
    template: '<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQYlciANNdQZG_67mUMNzGb8xakAhMGqjmqTcqu18VBqw2FOOcAld8AIg0P">'
  };
});
$(function() {
  
  $('input[name="which-guy"]').click(function() {
    
    $('#app').remove();
    
    $(document.createElement('div'))
      .attr('id', 'app')
      .append($('#app-template').html())
      .insertAfter('#app-template');
      
    angular.bootstrap($('#app')[0], [$(this).val()]);
    
  });
  
});
Output

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

Dismiss x
public
Bin info
adamshaylorpro
0viewers