Anyone can help me how to do show this data from or using factory? 

.controller('versionController', ['$scope','$ionicSideMenuDelegate', 
function($scope,$ionicSideMenuDelegate,versionsFactory){
        console.log('versionController');

           $scope.toggleLeft = function() {
            $ionicSideMenuDelegate.toggleLeft();
        };
                        getList(); 
function getList(){ 
 $scope.data = ["JavaScript","Java","Ruby","Python","CSS"]; 
}
    }])

===========================================
The above code is working fine but i want it with factory.

I tried like this but there is no display:

.factory( 'versionsFactory', function(){ 
var data = ["JavaScript","Java","Ruby","Python","CSS"];
var factory = {};
factory.getData = function()
{
return data;
}; 
return factory
});

.controller('versionController', function($scope, versionsFactory)
{
$scope.data = [];

getList();
function getList(){
$scope.data = versionsFactory.getData();
}
})

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to