AngularJS Access $scope in function
AngularJS Access $scope in function
我在执行页面时执行以下函数:
$scope.displayTags = function(Id) {
$scope.toogleSelectionBlocs = function selectionB(b) {
// I have a checkbox to check...
}
$scope.showHello() {
console.log("HELLO WORLD!");
}
}
然后我还有一个另一个复选框:(相同的控制器但其他功能)
$scope.checkClick = function(){
if($scope.mycheckbox == true){
$scope.showHello();
}
}
我有以下错误:
TypeError: undefined is not a function
at Scope.$scope.checkClick (....)
我该如何解决?
感谢您的帮助!
1)
$scope.showHello缺少"=function(params){ .... }"部分。 (这应该可以解决您要求的问题)
2)你能发布更多的控制器代码来明确你实际想要做什么吗 - 代码对我来说看起来有点奇怪。(例如"= 函数选择B(b) {"部分。
你的函数中有一个错误,应该是:
$scope.showHello = function() {
console.log("HELLO WORLD!");
}
还有一件事,为什么你把函数写在另一个函数里面,你应该把$scope.showHello移到$scope的外面
相关文章:
- javascript multiple if in function
- draw() function of Processing in Javascript
- Is it good to make function in function using 'return
- Call a function from a <a> tag in javascript?
- Jquery If/Then in Click Function?
- Dynamics Variable (variable++) in Append function DOM Javasc
- Javascript: argument unpacking in function.prototype.bind()?
- $(function () { } in javascript/Jquery 中的意思是什么
- AngularJS Access $scope in function
- checkbox onclick function in another function
- $ sign in JavaScript function
- Function Expected In IE7 & IE8
- JS function in Brython
- apply() / call() vs [function]() in jquery
- java.lang.Double.longBitsToDouble function in JavaScript
- what is the Template.templateName.rendered= function(){} in
- Angular Function not Called in <span> tag
- Variable function names in Require & Backbone
- Javascript eval in function
- 如何修复“;return not in function”;firebug上显示的错误