Skip to content

Instantly share code, notes, and snippets.

@haraldfianbakken
Created April 10, 2014 08:42
Show Gist options
  • Save haraldfianbakken/10357499 to your computer and use it in GitHub Desktop.
Save haraldfianbakken/10357499 to your computer and use it in GitHub Desktop.
controller-example
controller : function ($scope, $log, $stateParams, init, service) {
var ctrl = new slideController($scope,$log,$stateParams,init);
$scope.addInsuranceCard = function(){
$scope.data.items.push({});
}
$scope.removeInsuranceCard = function(card){
var confirmed = confirm('Do you want to remove this item?');
if(confirmed){
$log.debug("Removing item @"+$scope.data.selectedIndex);
$scope.data.items.splice($scope.data.selectedIndex,1);
$scope.selectedItem = $scope.data.items[$scope.data.selectedIndex];
}
}
return ctrl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment