Skip to content

Commit

Permalink
Support promises #19
Browse files Browse the repository at this point in the history
  • Loading branch information
asafdav committed Apr 27, 2014
1 parent 12c6db4 commit 241d675
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
9 changes: 2 additions & 7 deletions build/ng-csv.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,7 @@ angular.module('ngCsv.directives', []).
{
var csvContent = "data:text/csv;charset=utf-8,";

var deferred = $q.defer();
var promise = deferred.promise;

promise.then(function ()
$q.when(data).then(function ()
{
// Check if there's a provided header array
if (angular.isDefined($attrs.csvHeader))
Expand Down Expand Up @@ -141,12 +138,10 @@ angular.module('ngCsv.directives', []).

$scope.csv = encodeURI(csvContent);

}).then(function ()
{
}).then(function() {
callback();
});

deferred.resolve();
};

$scope.getFilename = function ()
Expand Down
2 changes: 1 addition & 1 deletion build/ng-csv.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 2 additions & 7 deletions src/ng-csv/directives/ng-csv.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ angular.module('ngCsv.directives', []).
{
var csvContent = "data:text/csv;charset=utf-8,";

var deferred = $q.defer();
var promise = deferred.promise;

promise.then(function ()
$q.when(data).then(function ()
{
// Check if there's a provided header array
if (angular.isDefined($attrs.csvHeader))
Expand Down Expand Up @@ -114,12 +111,10 @@ angular.module('ngCsv.directives', []).

$scope.csv = encodeURI(csvContent);

}).then(function ()
{
}).then(function() {
callback();
});

deferred.resolve();
};

$scope.getFilename = function ()
Expand Down

0 comments on commit 241d675

Please sign in to comment.