AngularJS不打印$ event

时间:2018-02-11 02:59:49

标签: angularjs

我正在使用下面的示例,但它没有打印$event中定义的值

以下是我的app.js

var myModule = angular.module("myModule",[])
myModule.controller("myController",function($scope){

    $scope.someName = "test";

})

以下是我的HTML

<html ng-app="myModule">

<head></head>
<body>

<div ng-controller="myController">

  This is Angular JS {{ someName }}
</div>
</body>
</html>

1 个答案:

答案 0 :(得分:1)

您的代码没有问题。请确保您已提及 angularjs 参考,如下所示

<强>样本

&#13;
&#13;
var myModule = angular.module("myModule",[])
myModule.controller("myController",function($scope){
   $scope.someName = "test";
});
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<html ng-app="myModule">
<head></head>
<body>
<div ng-controller="myController">
  This is Angular JS {{ someName }}
</div>
</body>
</html>
&#13;
&#13;
&#13;