Ionic Swipe Cards - without 'start-card'?

Hi,

I’m currently using the ionic_swipecards.js and a modified js for controllers. All is going well, I’m new to the world of Ionic/Angular etc.

Basically what I’m trying to do now is to load a card when the page loads? I’ve removed the start swipe card from the index.html and added some code in my CardsCtrl controller like this:

$scope.$on('$ionicView.loaded', function(){
		$scope.addCards();
});	

From the logs the card gets loaded, but not pushed? I’ve no idea where to go from here. I’ve tried a number of trial and errors inside the above function but nothing worked. I cannot get a card to appear. Adding back in the start-card and swiping it works perfectly.

Any help greatly appreciated!!

After 2 hours of messing around, finally got it. Erased $scope.$on code.

Added an ng-init where the ng-controller=“CardsCtrl” is in the index.html. Here’s the code:

<ion-pane ng-controller="CardsCtrl" ng-init="init()">

Then add the addCards() in the init function of the controller js:

$scope.init = function () {
  		$scope.addCards();
}; 

Sometimes you just need to spell it out :smile: