Whenever I use {{callData}}
in my HTML, the result of $scope.callData
doesn't seem to be functioning properly. Is there something wrong with my code? I would greatly appreciate any help in resolving this issue.
phonecatControllers.controller('PhoneListCtrl',
['$scope', 'Phone', function($scope, Phone){
$scope.phones = Phone.query();
$scope.sortir = 'age';
$scope.getCount = function(){
return $scope.phones.length;
};
$scope.$emit('showData', {
showData: $scope.getCount
});
}]);
phonecatControllers.controller('PhoneDetailCtrl', ['$scope', '$routeParams', 'Phone',
function($scope, $routeParams, Phone) {
$scope.phone = Phone.get({phoneId: $routeParams.phoneId}, function(phone) {
$scope.mainImageUrl = phone.images[0];
});
$scope.setImage = function(imageUrl) {
$scope.mainImageUrl = imageUrl;
}
}]);
phonecatControllers.controller('JumlahCtrl', ['$scope',
function($scope) {
$scope.$on('showData', function(event, obj){
console.log(obj);
$scope.callData = function(event){
obj.showData();
};
})
}]);
<div>
<span>jumlah : {{callData()}} </span>
</div>
Why is the result of $scope.callData
not displaying correctly?