0

I've a trouble accessing a scope variable from a json object (which is again a scope variable). Here is the code snippet.

code inside of my controller

$scope.myJsonObj = {
name: 'abcd',
details: $scope.getDetails()
};

$scope.getDetails = function () {
//some code
};

It says $scope.getDetails is not a function. Also I tried using this.getDetails() and ended up with same error.

1
  • 3
    You have to define $scope.getDetails() first. Commented Jul 22, 2015 at 8:12

1 Answer 1

2

You are trying to access a function not yet defined in $scope.

Therefore, you have to define $scope.getDetails first.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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.