aboutsummaryrefslogtreecommitdiffstats
path: root/example/memoryLeak.html
blob: 19b0d45d9c729b8402bdd3e2b90b1b66e2eedc4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <script type="text/javascript" src="../lib/underscore/underscore.js"></script>
    <script type="text/javascript" src="../lib/jquery/jquery-1.3.2.js"></script>
    <script type="text/javascript" src="../src/angular-bootstrap.js"></script>
    <script type="text/javascript">
      $(document).ready(function(){
        var scope = angular.compile(document);
        scope.init();
        scope.set("add", function(){
          var partial = $("#partial");
          //id++;
          partial.html('<div>{{ error() }}<br/></div>');
          var scope = angular.compile(partial);
          scope.set("hello", function (){
            return 'who dat?';
          });
          scope.set("error", function (){
            this.misko.length;
          });
          function XXXXXXXXX(){};
          scope.set('xxx', new XXXXXXXXX());
          scope.set("names", ["adam", "misko", "shyam"]);
          scope.init();
        });
        scope.set("remove", function(){
          var partial = $("#partial");
          /*
          partial.find('*').andSelf().each(function(){
            var scope = $(this).data('scope');
            if (scope) {
              delete scope.state;
              delete scope.widgets;
            }
            var cntl = $(this).data('controller');
            if (cntl) {
              delete cntl.view;
            }
            $(this).removeData();
          });
          */
          partial.removeData('scope');
          partial.children().remove();
        });
      });
    </script>
    <link rel="StyleSheet" type="text/css" href="../css/angular.css"/>
  </head>
  <body>
  <input type="button" value="add" ng:click="add()"/>
  <input type="button" value="remove" ng:click="remove()"/>
  <div id="partial"></div>
  </body>
</html>
"hello.html" ng-html-wrap="angular.js angular-resource.js myApp abc.js abc.css"></pre> <h2>Directive <code>ng-embed-app</code></h2> <div ng-embed-app="myApp">{{text}}</div> <h1>Bootstrap</h1> <h2>Directive <code>drop-down-toggle</code></h2> <div class="btn btn-primary dropdown"> <a href="#ABC" class="dropdown-toggle"> Account <b class="caret"></b> </a> <ul class="dropdown-menu"> <li>One</li> <li>Two</li> </ul> </div> <h2 ng-init="state = 'tab-2' ">Directive <code>tabbable</code></h2> state = {{state}} <div class="tabbable" ng-model="state"> <div class="tab-pane" ng-repeat="id in [1,2,3]" title="Tab {{id}}" value='tab-{{id}}'> Tab content {{id}}! </div> </div> <hr/> <div class="tabbable" ng-model="state"> <div class="tab-pane" ng-repeat="id in [1,2,3]" title="Tab {{id}}" value='tab-{{id}}'> Tab content {{id}}! </div> </div> <hr/> <div class="tabbable"> <div class="tab-pane" ng-repeat="id in [1,2,3]" title="Tab {{id}}" value='tab-{{id}}'> Tab content {{id}}! </div> </div> </div> </div> </div> <br/> <br/> <br/> <br/> <br/> <br/> </body> </html>