Issue with Factory

Hi Experts,

Need your help with an example app that I am building to learn ionic.

I’ve an index.html file which contains 2 views, list.html and view.html.

  1. list.html: This view contains an input form with the elements ‘description’, ‘venue’ and ‘date’. It also has a button, which calls a function called newEvent() defined using ng-submit.

I’ve a factory called eventsService. I’ve defined an empty array called fork[] and this factory contains 2 services createEvent and getEvent. The createEvent method should add the values obtained from the input form to the array fork[] and the getEvent method should retrieve the values from the array fork[]

Now, in the controller of the list.html file, I capture the data entered in the input form using the $scope. Then I define the newEvent() method (from the ng-submit of list.html) to call the service createEvent() from the factory eventsService to push the data in $scope to the array fork[] but this doesn’t work. Could you pls help to identify where I am wrong? Thanks very much for your time!

codepen link: http://codepen.io/Aj_Rev/pen/gPbaOv?editors=101

Changed some stuff

Thank You Triniwiz!! for your help.
Original:
nameApp.controller(‘ViewCtrl’, function($scope, eventsService) {
$scope.events = function () {
eventsService.getEvent();
}
});

Your change:
nameApp.controller(‘ViewCtrl’, function($scope, eventsService) {
$scope.events = eventsService.getEvent();
});

So, the funciton that I created was the cause. Thanks again!
Regards,
Aj

Thank You Triniwiz!! for your help.
Original:
nameApp.controller(‘ViewCtrl’, function($scope, eventsService) {
$scope.events = function () {
eventsService.getEvent();
}
});

Your change:
nameApp.controller(‘ViewCtrl’, function($scope, eventsService) {
$scope.events = eventsService.getEvent();
});

So, the funciton that I created was the cause. Thanks again!
Regards,
Aj