function displayController($scope)
{
$scope.currentView = myCustomInstance.currentView;
$scope.$watch($scope.currentView,
function(newValue, oldValue)
{
console.log(newValue);
console.log(oldValue);
console.log($scope.currentView);
if($scope.currentView != null)
$scope.data = $scope.currentView.dataset;
}
);
}
Output in console:
undefined script.js:10
undefined script.js:11
null
The object myCustomInstance represents an instance of a custom JavaScript class I developed. Initially, its currentView is set to null but changes value once the instance is created.