Skip to content

Instantly share code, notes, and snippets.

@Rubytastic2 Rubytastic2/angular.js Secret
Created Oct 26, 2016

Embed
What would you like to do?
adduser(user) {
var creds = "name=" + user.name + "&password=" + user.password;
var headers = new Headers();
headers.append('Content-Type', 'application/x-www-form-urlencoded');
return new Promise(resolve => {
this.http.post('http://api.local.dev:3000/v1/', creds, {headers: headers}).subscribe(data => {
if (data.json().success) {
resolve(true);
}
else
resolve(false);
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.