ng-click Angular JS issue
ng-click Angular JS issue
Angular JS新手,尝试使用ng-click访问click事件。
HTML:<button ng-click="selectNav($event)">Click</button>
JS:
angular.module('app').controller('ctrl', function(){
$scope.selectNav = function($event){
console.log($event);
}
});
单击按钮时,它没有给出$event的值。谁能告诉我我哪里做错了?
我注意到您没有将$scope
传递给控制器。试着修改一下
angular.module('app').controller('ctrl', function($scope){
$scope.selectNav = function($event){
console.log($event);
}
});
控制器$scope
有问题
angular.module('app').controller('ctrl',['$scope', function($scope){
$scope.selectNav = function($event){
console.log($event);
}
}]);
相关文章:
- Three.js issue creating meshes outside of loader's load(
- Stage.load(json) Issue..Kinetic.js
- JS parseInt() issue
- jQuery waypoints static html/ js issue
- js/jq form validation issue/help(jquery)
- Node.JS JSON.parse UTF-8 issue
- AWS JS SDK, IAM and DynamoDB Issue
- Featherlight Lightbox JS issue
- 使用Knockout.js Issue将元素动态添加到嵌套列表中
- Issue Filtering Knockout.js observable array
- Glide.js api issue
- Issue with angular js 1.3.14
- Prototype.js Issue
- ng-click Angular JS issue
- document.write js issue
- OBJ Loader THREE.JS Issue
- Postscribe.js issue in IE8
- Angular JS Ng-Repeat Issue
- PDF.js CORS issue
- setInterval issue (js)