我需要在角色中传递字符串对象的数组,而不是字符串?
saveUser(name,password,email, role1) {
arr:String[]=[];
return this.http.post<any>('url',
{
name:name,
password:password,
email:email,
arr:String[0]:role,// here need to pass an array object with value in 0 index
}). pipe( share(),
catchError(this.errorHandle));
saveUser(name,password,email, role1) {
arr:string[]=[];
arr.push(role1);
return this.http.post<any>('url',
{
name:name,
password:password,
email:email,
arr:arr,// pass like this
}). pipe( share(),
catchError(this.errorHandle));
}
role: any =[] // Global Variable for.
saveUser(name,password,email, role1) {
this.role = role1;
return this.http.post<any>('url',
{
name:name,
password:password,
email:email,
arr:this.role
}). pipe( share(),
catchError(this.errorHandle));
}