Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

month detail view customization. ng-click event not working #159

Open
raheelshan opened this issue Sep 11, 2017 · 5 comments
Open

month detail view customization. ng-click event not working #159

raheelshan opened this issue Sep 11, 2017 · 5 comments

Comments

@raheelshan
Copy link

raheelshan commented Sep 11, 2017

Hi, i am customizing view like this

$scope.monthviewEventDetailTemplateUrl = 'templates/event-details.html';

Next i am customizing view by adding edit and delete controls when user views the details of event.

<tr ng-repeat="event in selectedDate.events">
	<td class="event-detail">
		{{::event.title}}
	</td>
	<td><i class="icon ion-ios-pencil-outline" ng-click="alert('hello')">Edit Event</i></td>
	<td><i class="icon ion-ios-trash-outline" ng-click="DeleteEvent(event)">Delete Event</i></td>
</tr>

Neither DeleteEvent nor alert is working. What can i do now?

@twinssbc
Copy link
Owner

@raheelshan Yes, it will try to look for method bind to the current scope, which is the internal scope in the calendar. So it can't call a method defined in your scope. As a workaround, you could add some method to your event object.

@raheelshan
Copy link
Author

i tried adding methods but it still fails.

@twinssbc
Copy link
Owner

@raheelshan Could you show me how do you add the method, and what's the error message?

@raheelshan
Copy link
Author

For testing i added these into directive scope to see if it works

eventDeleted: '&',
eventEdited: '&',

Then in

event-deleted="onEventDeleted(event)" event-edited="onEventEdited(event)" 

And added these two methods in controller

$scope.onEventEdited = function (event) {
    console.log('Event selected:' + event.startTime + '-' + event.endTime + ',' + event.title);
};

$scope.onEventDeleted = function (event) {
    console.log('Event selected:' + event.startTime + '-' + event.endTime + ',' + event.title);
};

It doesn't seem to work as it works for event-selected.
The alternate way i found to work is to create a directive and achieved this.

@twinssbc
Copy link
Owner

@raheelshan Do you mean you were trying to modify the source code but it didn't work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants