0

I am a new learner of angular, typescript and nodejs with mysql. but i have read some tutorials. but when i want some extra knowledge. they are not help us. Please any one help me.

presently i have a some little problem. i want 1 row data using typescript file and then assign in my model for showing in html page.

my code is >>>

export class ProgrammePageEditComponent implements OnInit {

  model = {pro_id: '0', pro_name: '', pro_discription: '', pro_index: 0 };

  allProgrammes: Programme_class[] = [];

  pro_id1 : any;

  constructor(
    private _dataProgramme: ProgrammedataService, 
    private router: Router, 
    private activatedRoute: ActivatedRoute) { }

  ngOnInit() {
    this.activatedRoute.params.subscribe((params: Params) => {
      this.pro_id1 = params;
      console.log(this.pro_id1);
      return params;
    });

    this.model.pro_id = this.pro_id1;

    this._dataProgramme.getProgrammeId(this.model.pro_id).subscribe(
      (data: Programme_class[]) => {
        console.log(this.model.pro_id);
        this.allProgrammes = data;
        console.log(this.allProgrammes);
      });
    }
}

i have done this code by reference from https://jinalshahblog.wordpress.com/2016/12/16/crud-in-angular2-part1/

user1727852
  • 123
  • 2
  • 10

0 Answers0