AngularJS is a new technology for me that I am using on my current project. However, I am facing confusion due to an error that keeps popping up.
The issue lies within a JavaScript function:
function ShowHideEditOptions(id) {
var editOptions = document.getElementById("editOptions");
editOptions.style.display = "block";
selectedNodeId = id;
InitializeMapForSelectedNode();
}
I am trying to call the InitializeMapForSelectedNode();
angular function within my ShowHideEditOptions(id){}
function.
Is this even possible?
Whenever I attempt to do this, it yields an error stating that $scope is undefined.
This is how my angular controller looks like in the view:
<script>
var app = angular.module('app', ['kendo.directives']);
var selectedNodeId = "";
app.controller("locationController", function ($compile, $scope, $log, $timeout) {
$scope.InitializeMapForSelectedNode = function () {
InitializeMapForSelectedNode($scope);
}
});
</script>
The actual Angular function causing the trouble is:
function InitializeMapForSelectedNode($scope) {
var locations = $scope.MeterList; // this line triggers the error
.....
}
This function relies on the previously bound $scope.MeterList variable. It seems that the issue arises because the $scope is considered as Undefined by Firebug.