Hello,
Frustration overload.
I have attached a console.log
message with each of the following <td-card>
events:
on-destroy="cardDestroyed($index)
,
on-swipe-left="cardSwipedLeft($index)"
on-swipe-right="cardSwipedRight($index)"
These template markup contains these events:
<td-cards >
<td-card ng-repeat="card in cards" on-destroy="cardDestroyed($index)" on-swipe-left="cardSwipedLeft($index)"
on-swipe-right="cardSwipedRight($index)" on-partial-swipe="cardPartialSwipe(amt)"
class="card-{{$index}}">
<!--ng-controller="CardCtrl"-->
<div class="image">
<div class="no-text">
<img class="img" src="img/dislike.png"/>
</div>
<img class="swipeImg" ng-src="{{card.image}}">
<div class="yes-text">
<img class="img" src="img/like.png"/>
</div>
</div>
</td-card>
The controller looks like this:
.controller('CardsCtrl', function($scope, TDCardDelegate) {
console.log('CARDS CTRL CALLED');
var cardTypes = [
{ image: 'img/movies.jpg', title: 'Movies'},
{ image: 'img/comedy.jpg', title: 'Comedy'},
{ image: 'img/technology.jpg', title: 'Technology'},
{ image: 'img/news.jpg', title: 'News'},
{ image: 'img/entertainment.jpg', title: 'Entertainment'}
];
$scope.cards = Array.prototype.slice.call(cardTypes, 0);
$scope.cardSwipedLeft = function (index) {
console.log("LEFT SWIPE");
$scope.addCard();
};
$scope.cardSwipedRight = function (index) {
console.log("RIGHT SWIPE");
$scope.addCard();
};
$scope.cardDestroyed = function(index) {
$scope.cards.splice(index, 1);
console.log("Card Destroyed!");
};
$scope.addCard = function() {
var newCard = cardTypes[(cardTypes.length)+1];
$scope.cards.push(angular.extend({}, newCard));
console.log("New card added!");
};
The following scripts are included in index.html
:
<script src="lib/collide/collide.js"></script>
<script src="lib/ionic-contrib-tinder-cards/ionic.tdcards.js"></script>
The 'ionic.contrib.ui.tinderCards'
dependency is injected into app.js
.
RESULT: Chrome Canary console:
CARDS CTRL CALLED
CARDS CTRL CALLED
5 Card Destroyed!
Each time a card is swiped, Card Destroyed!
is logged to the console.
However, the direction of the swipe is not registering and I cannot figure out why.
I have tried replacing on-swipe-left
/ on-swipe-right with ng-swipe-left
/ng-swipe-right
but nothing changes.
Am I missing something?