Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Access to parent scope/controller in #415
The github issues tracker is for bug reports and feature requests ONLY. Please use stackoverflow or read the documentation and examples for support issues, as well as checking previous issues.
Issues that ignore this template will be closed without notice!
Bug description / Feature request:
I used a custom template for the calendarMonthCell. To do what I needed, I needed access to functions in the controller for the parent scope. I couldn't find any options that allowed that, so I wanted to make a feature request for one. Here's how I solved it:
In the mwlCalendar directive I added to the scope:
In the mwlCalendarMonth directive I added to the scope:
(You could add it to the other view directives too, but I am only using the month view)
In the template for the month view that uses the mwl-calendar-month directive I added:
(Again you could do the same thing in the other view templates.)
And in my custom template I was able to access the parent controller via vm.parentCtl.
There might be a better way to do this via transclusion but I had trouble doing it that way because I then also needed transclusion in the view directives and it caused conflicts. I'm open to other possibilities though. I think this would be a really good addition to angular-bootstrap-calendar.
Great job with angular-bootstrap-calendar. It works really well!
Link to minimally-working plunker that reproduces the issue (starter template: http://plnkr.co/edit/LE4F4U7AnnD3tjM9ZH4G?p=preview)
Calendar directive: 0.22.0
Browser name and version:
BTW, this was done as part of my work for Social and Scientific Systems and you can reach me at email@example.com regarding it.