Sha256: 94f629b22c83846da554ed894a30644c47dc1be4f4429e2cede3149a5043576f
Contents?: true
Size: 869 Bytes
Versions: 19
Compression:
Stored size: 869 Bytes
Contents
angular.module 'NgDestroy', ['Factories'] .directive 'ngDestroy', ($timeout, $compile) -> restrict: 'A' link: (scope, element, attributes) -> element.bind 'click', (event) -> scope.destroy(attributes.ngDestroy,attributes.ngContext) controller: ($scope, $injector) -> $scope.destroy = (modelName,listName) -> raw_factory = modelName.split('_') factory=[] for word in raw_factory factory.push(word.charAt(0).toUpperCase() + word.slice(1)) factory = factory.join('') if listName list = $scope for scope in listName.split('.') list = list[scope] else list = $scope[factory] list.splice(list.indexOf($scope[modelName]),1) list = $injector.get(factory) object = {id: $scope[modelName].id} list.delete object
Version data entries
19 entries across 19 versions & 1 rubygems