I'm having trouble with this issue. The rating feature in Angular Bootstrap is not under my control, and I am attempting to serialize the rating through a controller that I defined. However, I am unable to access the parent article. As a newcomer to AngularJS, I have been experimenting with $scope.$parent which does provide me access to an article property, but when I try $scope.$parent.article it returns undefined. There must be another solution.
Here is the specific markup causing the issue:
<div class="article full" data-ng-model="article">
<header class="page-header">
<h4>{{article.title}}</h4>
<div class="article-rating" rating ng-controller="RatingsCtrl" value="article.rating" max="5"></div>
</header>
<!-- ... -->
</div>
This is the directive in question https://github.com/angular-ui/bootstrap/blob/master/src/rating/rating.js. Here is my attempt at finding a solution, although it doesn't provide much context:
angular.module("myApp")
.controller("RatingsCtrl", ($scope) ->
console.log $scope.$parent.article #=> undefined
$scope.$watch 'value', (newVal, oldVal) ->
console.log "newVal = #{newVal} oldVal=#{oldVal}"
console.log $scope.$parent.article #=> undefined
)