Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ng new pjt
- cd pjt
- npm install jquery fullcalendar --save
- [styles]
- "../node_modules/fullcalendar/dist/fullcalendar.min.css"
- [scripts]
- "../node_modules/jquery/dist/jquery.js",
- "../node_modules/moment/min/moment.min.js",
- "../node_modules/fullcalendar/dist/fullcalendar.min.js"
- import * as jQuery from "jquery";
- (window as any).$ = (window as any).jQuery = jQuery;
- <div id='calendar'></div>
- <div id="test" (click)="Clicked()" hidden="true"></div>
- import 'fullcalendar';
- declare let $:any;
- @Component({...})
- export class AppComponent {
- ...
- ngOnInit(){
- $('#calendar').fullCalendar({
- dayClick: function(date, jsEvent, view) {
- //alert('Clicked on: ' + date.format());
- $(this).css('background-color', 'red');
- ***** WANT A BETTER WAY TO CALL NG CLICKED() FUNCTION HERE TO REPLACE THE FOLLOWING 2 LINES *****
- document.getElementById("test").innerText = date.format();
- document.getElementById("test").click();
- }
- });
- $('#calendar').fullCalendar('changeView', 'agendaDay');
- }
- Clicked() {
- alert("Alert from ng func");
- }
- }
Add Comment
Please, Sign In to add comment