Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html ng-app="app">
<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>
<script src="http://code.angularjs.org/1.2.14/angular-sanitize.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body ng-controller="mainController">
  
  <h3>A Demo to Dynamically Add/Remove Javascript with AngularJS</h3>
  <button ng-click="setScript(one)">One</button>
  <button ng-click="setScript(two)">Two</button>
  <button ng-click="setScript(three)">Three</button>
  
  <script ng-repeat="script in scripts" ng-bind-html="script"></script>
 
  
  <script>
      var app = angular.module('app', ['ngSanitize']);
      app.controller('mainController', function($scope){
        $scope.scripts = {};
        $scope.one = "alert('one')";
        $scope.two = "alert('two')";
        $scope.three = "alert('three')";
        $scope.script = '';
        $scope.setScript = function(script) {
          $scope.scripts = [script];
        }
      });
  </script>
</body>
</html>
Output 300px

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

Dismiss x
public
Bin info
JasonGoemaatpro
0viewers