diff options
| author | Misko Hevery | 2010-03-15 14:36:50 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-03-15 14:36:50 -0700 |
| commit | cc71b745c3c821f5e012a363ae3267252a81fddb (patch) | |
| tree | b86a76a131aa222b8bdf032480dc2ef0dca51a97 /example | |
| parent | bf838aab5d65a1019a4867b496e971c488589512 (diff) | |
| download | angular.js-cc71b745c3c821f5e012a363ae3267252a81fddb.tar.bz2 | |
added resources; removed compiled code
Diffstat (limited to 'example')
| -rw-r--r-- | example/memoryLeak.html | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/example/memoryLeak.html b/example/memoryLeak.html index 35169da8..bdfe3faf 100644 --- a/example/memoryLeak.html +++ b/example/memoryLeak.html @@ -6,17 +6,50 @@ <script type="text/javascript" src="../src/angular-bootstrap.js"></script> <script type="text/javascript"> $(document).ready(function(){ - angular.compile(document).init(); + 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> - Filter: <input name="filterText"> - <ul ng-init="names=['misko']"> - <li ng-repeat="name in names.$filter(filterText)"> - <a href="" ng-action="greet(name)">{{name}}</a> - </li> - </ul> + <input type="button" value="add" ng-action="add()"/> + <input type="button" value="remove" ng-action="remove()"/> + <div id="partial"></div> </body> </html> |
