Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <tr *ngFor="let detail of userDetails" style="text-align:center">
- <td><input type="checkbox"></td>
- <td>{{detail.username}}</td>
- <td>{{detail.uemail}}</td>
- <td>Inactive</td>
- <td>{{detail.added_on}}</td>
- <td>
- <a routerLink="/dashboard-info/basic-settings">
- <i class="fas fa-edit" (click)="editIssue(i,detail._id)"></i>
- </a>
- import { Component, OnInit } from '@angular/core';
- import { FormBuilder, FormGroup , Validators } from '@angular/forms';
- import { DataService } from '../../../services/data.service';
- import { AccountService } from '../../../services/account.service';
- import { Router } from '@angular/router';
- @Component({
- selector: 'app-manage-users',
- templateUrl: './manage-users.component.html',
- styleUrls: ['./manage-users.component.css'],
- })
- export class ManageUsersComponent implements OnInit {
- userDetails:any = [];
- detail:Detail={
- added_on:'',
- username:'',
- uemail:'',
- upassword:'',
- };
- constructor(private router: Router,private fb:FormBuilder,private dataService: DataService, private accountService: AccountService) {}
- editIssue(id,detail){
- alert(detail);
- let data = {
- _id:detail,
- };
- this.accountService.editDetail(data).subscribe(
- response => {
- console.log(response);
- this.userDetails = JSON.parse(response);
- //this.router.navigate(['/dashboard-info/basic-settings', this.userDetails]);
- },
- err => {
- console.error('User Not found');
- })
- }
- ngOnInit() {}
- }
- interface Detail{
- added_on:string
- username:string,
- upassword:string,
- uemail:string,
- }
- editDetail(data) {//Getting User with userId
- return this.http.post(this.apiPath + 'user/editDetail', data,{responseType: 'text'});
- }
- userRouter.post('/editDetail', function (req, res) {
- console.log(req.body._id);
- Collections.user.findOne({_id: req.body._id}, function (err, result) {
- if (err) return res.status(500).send("There was a problem finding the user");
- if (result) {
- console.log(result);
- res.status(200).send(result);
- } else {
- return res.status(500).send("User Not Found with Details: " + JSON.stringify(user));
- }
- });
- });
Add Comment
Please, Sign In to add comment