File Upload using AngularJS

Some of the answers here propose using FormData(), but unfortunately that is a browser object not available in Internet Explorer 9 and below. If you need to support those older browsers, you will need a backup strategy such as using <iframe> or Flash. There are already many Angular.js modules to perform file uploading. These two … Read more

ng-model for “ (with directive DEMO)

I created a workaround with directive: .directive(“fileread”, [function () { return { scope: { fileread: “=” }, link: function (scope, element, attributes) { element.bind(“change”, function (changeEvent) { var reader = new FileReader(); reader.onload = function (loadEvent) { scope.$apply(function () { scope.fileread = loadEvent.target.result; }); } reader.readAsDataURL(changeEvent.target.files[0]); }); } } }]); And the input tag becomes: … Read more

Is this a “Deferred Antipattern”?

Is this a “Deferred Antipattern”? Yes, it is. ‘Deferred anti-pattern’ happens when a new redundant deferred object is created to be resolved from inside a promise chain. In your case you are using $q to return a promise for something that implicitly returns a promise. You already have a Promise object($http service itself returns a … Read more

Why are AngularJS $http success/error methods deprecated? Removed from v1.6?

The problem was that .success and .error methods are not chainable because they ignore return values. This caused problems for people familiar with chaining and encouraged poor code from people unfamiliar with chaining. Witness all the examples on StackOverflow that use the deferred anti-pattern. To quote one of the AngularJS team: IMO .success and .error … Read more

AngularJS: Service vs provider vs factory

From the AngularJS mailing list I got an amazing thread that explains service vs factory vs provider and their injection usage. Compiling the answers: Services Syntax: module.service( ‘serviceName’, function ); Result: When declaring serviceName as an injectable argument you will be provided with an instance of the function. In other words new FunctionYouPassedToService(). Factories Syntax: … Read more

AngularJS Dependency Injection when no dependencies

Because angular.module(‘app’) with 1 parameter has a different function – to get an already existing module without having a code reference to it. The reason this: angular.module(‘app’, []); // Define the module. angular.module(‘app’); // Get the module. works as well as this: var app = angular.module(‘app’, []); // Define the module and assign to variable.

Is it feasible for a start-up of two developers to do full automated regression testing without manual testing? [closed]

The answer to this question is highly opinionated, but I’ll give it a shot anyway. From what you have described, seems you are “holding it wrong” in many ways. Your sprints are too long. You should be pushing to production once a day and should not be doing 2 hour of “regression testing” before every … Read more