I have a directive with scope variables that depend on other scope variables. I would expect that if the scope variable on the right side of the equation changed it would update the left, but this doesn't seem to be happening.
In the example below when running selectProduct() it should update the product information including the product title, but it does not work unless I update scope.title directly as in the commented line at the bottom of the function.
controller:function($scope){
$scope.products = $scope.productGroup.products;
$scope.selected_product = $scope.productGroup.products[$scope.productGroup.selected_product];
$scope.title = _.isEmpty($scope.selected_product) ? $scope.productGroup.title : $scope.selected_product.title;
$scope.excerpt = _.isEmpty($scope.selected_product) ? $scope.productGroup.excerpt : $scope.selected_product.excerpt;
$scope.description = _.isEmpty($scope.selected_product) ? $scope.productGroup.description : $scope.selected_product.description;
$scope.selectProduct = function(){
$scope.selected_product = $scope.productGroup.products[1];
console.log($scope.selected_product);
//$scope.title = $scope.selected_product.title;
}
},