Hi ,

I am new to Angular I need urgent help.

I have integrated footable into our application through AJAX. api would 
return data in JSON format as I wanted a click button i used footable 
formatter function

  'formatter': function (value) {
         return '<button class="btn btn-primary" id="comments" 
type="button" (click)="showComments()">Comments</button>'
}

problem is click functionality do not trigger. so I used

$(".table").on("click", "#comments", function(e){
   e.preventDefault();
   var row = FooTable.getRow(this)
   console.log(row.value.id);
   var value = row.value.id;
    const btns: PopUpButton[] = [{
          label: 'Okay',
          callback: () => { this.router.navigate(['/reports']); }
      }];
      
      const commentsData: CommentsData =
          new CommentsData(value,
              btns);
      this.commentsPopupService.showDialog(commentsData);  
  });

}

but the above code click would work and result in the below error

ERROR TypeError: Cannot read property 'showDialog' of undefined

Below is the comments.popup.service.ts

import { Injectable } from '@angular/core';
import { CommentsData } from './commentsData';
import { BehaviorSubject } from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class CommentsPopupService {

dialogsData: BehaviorSubject<CommentsData> = new 
BehaviorSubject<CommentsData>(new CommentsData());

  constructor() {
    // this.dialogsData = new PopUpData();
   }

showDialog(data:CommentsData) {
    data.showDialogsBox = true;
    this.dialogsData.next(data);
}

hideDialog() {
  this.dialogsData.next(new CommentsData());
}

}


pls help me to resolve the issue.

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/angular/f2a02600-7d17-4b4f-802f-dd7a6df9d411o%40googlegroups.com.

Reply via email to