AngularJS Uploading An Image With ng-upload

There’s little-no documentation on angular for uploading files. A lot of solutions require custom directives other dependencies (jquery in primis… just to upload a file…). After many tries I’ve found this with just angularjs (tested on v.1.0.6) html <input type=”file” name=”file” onchange=”angular.element(this).scope().uploadFile(this.files)”/> Angularjs (1.0.6) not support ng-model on “input-file” tags so you have to do … 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

Using success/error/finally/catch with Promises in AngularJS

Promises are an abstraction over statements that allow us to express ourselves synchronously with asynchronous code. They represent a execution of a one time task. They also provide exception handling, just like normal code, you can return from a promise or you can throw. What you’d want in synchronous code is: try{ try{ var res … Read more

The ‘Access-Control-Allow-Origin’ header contains multiple values

We ran into this problem because we had set up CORS according to best practice (e.g. http://www.asp.net/web-api/overview/security/enabling-cross-origin-requests-in-web-api) AND ALSO had a custom header <add name=”Access-Control-Allow-Origin” value=”*”/> in web.config. Remove the web.config entry, and all is well. Contrary to @mww’s answer, we still have EnableCors() in the WebApiConfig.cs AND an EnableCorsAttribute on the controller. When we … Read more

How do I POST urlencoded form data with $http without jQuery?

I think you need to do is to transform your data from object not to JSON string, but to url params. From Ben Nadel’s blog. By default, the $http service will transform the outgoing request by serializing the data as JSON and then posting it with the content- type, “application/json”. When we want to post … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)