使用下面的代码段我正在验证电子邮件,密码。 customerlogin()
方法返回一些我想在下一页显示的JSON数据。换句话说,我想从customerlogin()
返回的数据传递给then()
,然后把它传递给/customerprofile
请帮如何在其他页面显示响应数据angularjs
login(form) {
this.submitted = true;
if (form.$valid) {
this.Auth.customerlogin({
email: this.operator.email,
password: this.operator.password
})
.then(() => {
// Logged in, redirect to home
this.$location.path('/customerprofile');
})
.catch(err => {
this.errors.login = err.message;
});
}
}
//其他文件Auth.js
customerlogin({
email,
password
}, callback) {
console.log('Customer Authentice Method');
return $http.post(properties.customer_login, {
email, password
})
.then(res => {
properties.GetId = res.data.id;
$cookies.put('token', res.data.token);
currentUser = User.get();
return currentUser.$promise;
})
.then(user => {
safeCb(callback)(null, user);
return user;
})
.catch(err => {
Auth.logout();
safeCb(callback)(err.data);
return $q.reject(err.data);
});
}
我想要的数据显示,这些文本框 enter image description here
'然后把它传递给/ customerprofile'。你想传递一些数据给**另一个**控制器? –
是的..我想要显示我的json数据在html页面使用angularjs –