I would like to work out how to convert this:
app.controller('AnswersCtrl', ['$scope', '$http', '$log', '$ionicModal', '$state', 'SuspectService',
function($scope, $http, $log, $ionicModal, $state, SuspectService) {
$scope.suspects = [];
SuspectService.getSuspects().then(function(data){
$scope.suspects = data;
});
$scope.goToClues = function(){
$state.go('clues')
};
}]);
into something that looks like this:
app.controller('AnswersCtrl', ['$http', '$log', '$ionicModal', '$state', 'SuspectService',
function($http, $log, $ionicModal, $state, SuspectService) {
var self = this;
self.suspects = [];
SuspectService.getSuspects().then(function(data){
self.suspects = data;
});
self.goToClues = function(){
$state.go('clues')
};
}]);
The code which utilises $scope works but the code which utilises this (self) doesn't.
I have tried a couple of variations and haven't been able to get it to work.