0

The demo can be viewed at:

http://plnkr.co/edit/tLiAWIQ3bCAo4z4VFYTc?p=preview

script.js

var app=angular.module('app',[])
app.controller('MyController', function($scope) {
  console.log("TEST")
  $scope.on("$destroy", function() {console.log("DESTROY")})
})

index.html:

<!DOCTYPE html>
<html ng-app='app'>

  <head>
    <script data-require="angular.js@*" data-semver="1.4.0-beta.3" src="https://code.angularjs.org/1.4.0-beta.3/angular.js"></script>
    <link rel="stylesheet" href="style.css" />
    <script src="script.js"></script>
  </head>

  <body ng-controller="MyController">
    <h1>Hello Plunker!</h1>
  </body>

</html>

enter image description here

Does anyone have ideas about why so many errors are throwed in plunkr? Is there a way to deal with this?

sideshowbarker
  • 81,827
  • 26
  • 193
  • 197
Hanfei Sun
  • 45,281
  • 39
  • 129
  • 237

1 Answers1

1

There is an error in code:

$scope.on("$destroy", function() {console.log("DESTROY")})

Right:

$scope.$on("$destroy", function() {console.log("DESTROY")})
dddd1919
  • 868
  • 5
  • 13