以下工作从一个调用函数 ActiveChange(variable)
a(href="javascript: ActiveChange('topStories');") Top Stories
但是如果函数被定义为 AngularJS $scope 函数,例如
function activeController ($scope) {
$scope.topStories='active';
$scope.mostRecent='lucky';
$scope.ActiveChange = function (activeTab) {
if(activeTab=='topStories'){
var x=document.getElementById("someinput");
x.value='happy to be alive';
$scope.topStories='active';
$scope.mostRecent='';
}
else {
alert('else');
$scope.topStories='happy';
$scope.mostRecent='active';
}
}
}
你如何调用 $scope.ActiveChange = function (activeTab) ?