JSFiddle - React, Tailwind, and code Playground

by rur_d

HTML

<script src="http://code.angularjs.org/angular-1.0.0rc10.js"></script>
<div ng-app>
   <input type="text" ng-model="appval">
   <input type="button" ng-click="$broadcast('something')" value="something">
   <div ng-controller="AppCtrl">
      <input type="button" value="destroy" ng-click="dispose()">
      <p>{{appval}}</p>
      <div ng-controller="SubCtrl">
         <p>{{someval}}</p>
         <p>{{appval}}</p>
         <input type="button" value="destroy" ng-click="dispose()">
      </div>
   </div>
</div>

<script type="text/javascript" charset="utf-8">
   function AppCtrl ($scope) {
      $scope.someval= "test"
      $scope.dispose = function(){
         $scope.$destroy();
      }
   }
   
   function SubCtrl ($scope) {
      $scope.$on("$destroy", function(){
         console.log("Destroy SubController");
      })
       $scope.dispose = function(){
         $scope.$destroy();
      }
      
      $scope.$on("something", function(){
         console.log("something over!");
      })
   }
</script>