Guest User

Untitled

a guest
Dec 18th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. ng new pjt
  2. cd pjt
  3. npm install jquery fullcalendar --save
  4.  
  5. [styles]
  6. "../node_modules/fullcalendar/dist/fullcalendar.min.css"
  7.  
  8. [scripts]
  9. "../node_modules/jquery/dist/jquery.js",
  10. "../node_modules/moment/min/moment.min.js",
  11. "../node_modules/fullcalendar/dist/fullcalendar.min.js"
  12.  
  13. import * as jQuery from "jquery";
  14. (window as any).$ = (window as any).jQuery = jQuery;
  15.  
  16. <div id='calendar'></div>
  17. <div id="test" (click)="Clicked()" hidden="true"></div>
  18.  
  19. import 'fullcalendar';
  20. declare let $:any;
  21.  
  22. @Component({...})
  23. export class AppComponent {
  24. ...
  25.  
  26. ngOnInit(){
  27. $('#calendar').fullCalendar({
  28.  
  29. dayClick: function(date, jsEvent, view) {
  30.  
  31. //alert('Clicked on: ' + date.format());
  32. $(this).css('background-color', 'red');
  33.  
  34. ***** WANT A BETTER WAY TO CALL NG CLICKED() FUNCTION HERE TO REPLACE THE FOLLOWING 2 LINES *****
  35. document.getElementById("test").innerText = date.format();
  36. document.getElementById("test").click();
  37. }
  38. });
  39.  
  40. $('#calendar').fullCalendar('changeView', 'agendaDay');
  41. }
  42.  
  43. Clicked() {
  44. alert("Alert from ng func");
  45. }
  46. }
Add Comment
Please, Sign In to add comment