我有一些功能的控制器:
'use strict';
App.controller('MyController', function MyController($scope){
var showDetails = function(item){
var element = $(item).find('.details');
element.slideDown();
}
var hideDetails = function(item){
var element = $(item).find('.details');
element.slideUp();
}
var log= function(){
console.log("sadsa");
}
});
由于控制台中没有错误,因此我在HTML中正确注入了控制器:
<div class="container-fluid team-section" ng-controller="MyController">
问题是,当我尝试从控制器触发功能或什至alert()ng-mouseover都无法正常工作时:
<div class="col-md-2 col-md-offset-1 team" ng-mouseover="log()" >
甚至
<div class="col-md-2 col-md-offset-1 team" ng-mouseover="alert()" >
如果我使用onmouseover效果很好。你知道为什么ng-mouseover不起作用吗?
log()
(和alert()
)需要在$scope
...上
$scope.log = function() {
console.log("sadsa");
};
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句