In my code, I am using ng-repeat to display data values from an object.
<div ng-controller="myctrl">
<ul ng-repeat="number in numbers">
<li><span ng-bind="number.first"></span></li>
<li><span ng-bind="number.second"></span></li>
<li><span ng-bind="number.third"></span></li>
</ul>
</div>
However, one of the property values in the object is dependent on the value of other properties (I want the value of third to be equal to first divided by second).
.controller('myctrl', function($scope) {
$scope.numbers = [
{
first: 8,
second: 5,
third: ? // (I need this to be first / second)
},
{
first: 4,
second: 5,
third: ? // (I need this to be first / second)
}
];
});
I am struggling with setting this up correctly as I find it harder than expected. It's been a while since I worked with AngularJS or JavaScript, so chances are I have approached the ng-repeat incorrectly.