1

I execute the following function when a page is executed:

$scope.displayTags = function(Id) {
 $scope.toogleSelectionBlocs = function selectionB(b) {
 // I have a checkbox to check...
 }
 $scope.showHello() {
 console.log("HELLO WORLD!");
 }
}

Then I have an other checkbox: (same controller but other function)

$scope.checkClick = function(){
 if($scope.mycheckbox == true){
 $scope.showHello();
 }
}

I have the following error:

TypeError: undefined is not a function
 at Scope.$scope.checkClick (....)

How I can fix it?

Thanks for your help!

asked Nov 13, 2014 at 14:11

2 Answers 2

2

1) $scope.showHello is missing the "=function(params){ .... } " part. (That should solve the problem you asked for)

2) Can you post more of your controller code to make clear what you are actually trying to do - the code looks a bit strange to me. (e.g. the "= function selectionB(b) {" part.

answered Nov 13, 2014 at 14:20
Sign up to request clarification or add additional context in comments.

Comments

1

You have a mistake in your function thats should be:

$scope.showHello = function() {
 console.log("HELLO WORLD!");
 }

and another thing why do you write the function inside another function, you should move the $scope.showHello to the outside of the $scope.displayTags

answered Nov 13, 2014 at 14:26

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.