I am new to Angular JS and I have a basic Angular App that simply sets up a scope object, sets up a few functions to initialize/create the scope object. When I use a console.log within my function it is reporting the $scope values that are set at the end of the scope function rather than the values of the scope object at the moment of console.log. I'm sure this is a basic execution order issue and I would appreciate any explanation or help with this issue.
Here is the angular code:
var module = angular.module('my-app', []);
function MainController($scope)
{
$scope.testDict = {};
$scope.createNewTestDict = function(){
$scope.testDict.test1 = {1: false, 2: false, 3: false}
}
$scope.initializeDict = function(){
$scope.createNewTestDict();
console.log($scope.testDict);
$scope.testDict.test1 = {1: true, 2: true, 3: true}
}
$scope.initializeDict();
}
JSFiddle Here: http://jsfiddle.net/U6ZKr/7/
So you will notice that the console.log in the actual scope object at the time of the log should be all values false, but they are coming out all true which was set after the console.log.
Thanks in advance for your help!