TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Raju Kandikonda
NA
26
9.4k
Angular 7 querystring param getting 'undefind'
Apr 29 2019 11:44 AM
Hi All.
I am getting in querystring format undefind. what is the wrong in my code . I want to show user enter details. Please help me.
http://devweb-adept.transit.nyct.com:8089/RMS_WebService/api/Logins/CheckPassword?Id=[undefind]&Password=[undefind].
"login.service.ts"
constructor(
private
http: HttpClient) { }
getLoginById(AdeptUserID: string, Password: string): Observable<Login[]>{
debugger
;
let params=
new
HttpParams().set(
'AdeptID'
, AdeptUserID).set(
'Password'
, Password);
console.log(params.toString());
return
this
.http.get<Login[]>(
this
.baseURL, {params});
}
"locing.component.ts"
constructor(
private
loginService: LoginService,
private
router:Router,
private
route: ActivatedRoute,
private
formbuilder: FormBuilder)
{}
onFormSubmit() {
this
.loading =
true
;
const
client =
this
.clientForm.value;
this
.getLogin(client);
this
.clientForm.reset();
}
ngOnInit() {
debugger
;
this
.clientForm =
this
.formbuilder.group({
AdeptUserID: [
''
, [Validators.required]],
Password: [
''
, [Validators.required]]
});
}
getLogin(login :Login){
debugger
;
this
.loading =
true
;
this
.loginService.getLoginById(
this
.clientForm.AdeptUserID,
this
.clientForm.Password).subscribe((response) => {
{
this
.Login=response;}
});
}
"login.component.html"
<div
class
=
"container"
>
<mat-card>
<mat-toolbar color=
"accent"
>
<div align=
"center"
style=
"color:white;text-align:right;"
>
Login
</div>
</mat-toolbar>
<br>
<br>
<mat-card-content>
<form [formGroup]=
"clientForm"
(ngSubmit)=
"onFormSubmit(clientForm.value)"
>
<table>
<tr>
<td
class
=
"tbl1"
>
<mat-form-field
class
=
"demo-full-width"
>
<input formControlName=
"AdeptUserID"
matTooltip=
"Enter login AdeptUserID"
matInput placeholder=
"AdeptUserID"
>
</mat-form-field>
<mat-error>
<span *ngIf=
"!clientForm.get('AdeptUserID').value && clientForm.get('AdeptUserID').touched"
>
</span>
</mat-error>
</td>
</tr>
<tr>
<td
class
=
"tbl1"
>
<mat-form-field
class
=
"demo-full-width"
>
<input formControlName=
"Password"
matTooltip=
"Enter login Password"
matInput placeholder=
"Password"
>
</mat-form-field>
<mat-error>
<span *ngIf=
"!clientForm.get('Password').value && clientForm.get('Password').touched"
>
</span>
</mat-error>
</td>
</tr>
</table>
<table>
<tr>
<td
class
=
"content-center"
>
<button type=
"submit"
mat-raised-button color=
"accent"
matTooltip=
"Click Submit Button"
[disabled] =
"!clientForm.valid"
>Login</button>
<button type=
"reset"
mat-raised-button color=
"accent"
matTooltip=
"Click Reset Button"
(click) =
"resetForm()"
>Reset</button>
</td>
</tr>
</table>
</form>
</mat-card-content>
</mat-card>
</div>
Reply
Answers (
2
)
Angularjs Chaining Promises and $q
What is the purpose of main.ts file in angular2?