Skip to content

Instantly share code, notes, and snippets.

@freshtonic
Created November 5, 2012 05:24
Show Gist options
  • Select an option

  • Save freshtonic/4015496 to your computer and use it in GitHub Desktop.

Select an option

Save freshtonic/4015496 to your computer and use it in GitHub Desktop.
Angular JS injection
CreativesController = ($scope, Creative, flash) ->
Creative.query (creatives) ->
$scope.creatives = creatives
# Delete an Creative
$scope.remove = (creative) ->
success = ->
$scope.creatives = _.reject $scope.creatives, (s) -> s is creative
flash.success 'successfully deleted creative'
error = ->
flash.error "could not delete creative #{err}"
creative.$delete success, error
CreativesController.$inject = ['$scope', 'Creative', 'flash']
Application.controller 'CreativesController', CreativesController
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment