how to upload file from ng-controller?

How can I upload a file from my angular controller. I am doing something like, On ng-click I am calling upload_file() function which is declared inside my controller. And I want to use something like this

$http.post("url", data).success().error(); 

url is of node upload service. It's working fine when I use like . But without using action there, I want to upload it from my function.
But I am not getting how to attach the file selected to the data here. I want to send some data along with file. Can I upload it in the way I am trying? please help me...

You can use angular-file-upload library:

Basically you need to $http.post like this:

$http({
                method: 'POST',
                url: config.url,
                headers: { 'Content-Type': false },
                transformRequest: function (data) {
                    var formData = new FormData();
                      formData.append('file', myFile);
                    for (key in myData) {
                        formData.append(key, myData[key]);
                    }
                    return formData;
                }
            }).success().error().progress()

The library supports IE with flash polyfill which normally doesn't support FormData so you cannot get the file object from the <input file...>.