How to use Angular JS API create file?