Guest User

Untitled

a guest
Nov 17th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. export class EventsService {
  2.  
  3. @Output() expandNav: EventEmitter<Number> = new EventEmitter();
  4.  
  5. trigExpandNav() {
  6. this.expandNav.emit(1);
  7. }
  8.  
  9. constructor() { }
  10. }
  11.  
  12. import {
  13. Component,
  14. OnInit,
  15. Output,
  16. EventEmitter
  17. } from '@angular/core';
  18. import {
  19. EventsService
  20. } from '../../services/events.service';
  21.  
  22. @Component({
  23. selector: 'app-header',
  24. templateUrl: './header.component.html',
  25. styleUrls: ['./header.component.css'],
  26. providers: [EventsService]
  27. })
  28. export class HeaderComponent implements OnInit {
  29.  
  30. constructor(eventsService: EventsService) {
  31. function fun() {
  32. eventsService.expandNav();
  33. }
  34. }
  35.  
  36. ngOnInit() {}
  37.  
  38. }
  39.  
  40. ERROR in src/app/layout/header/header.component.ts(21,7): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'EventEmitter<Number>' has no compatible call signatures.
  41.  
  42. eventsService.expandNav.emit("Yourdata")
Add Comment
Please, Sign In to add comment