Skip to content
This repository has been archived by the owner. It is now read-only.

Unable to set custom-template-url for week view (only works from config) #422

Closed
mminor-dev opened this Issue Aug 10, 2016 · 7 comments

Comments

Projects
None yet
2 participants
@mminor-dev
Copy link

mminor-dev commented Aug 10, 2016

I am unable to get the calendar attribute 'custom-template-urls' to work for a week view. It does, however, work using the config setting. I'll likely need to use different customized templates for the week view to meeting some client needs. Is there something I'm missing to get this to work per-calendar instance?

Current markup - does not work

<mwl-calendar view="vm.calendarView"
   view-date="vm.viewDate"
   events="item.ScheduledFlights"
   view-title="calendarTitle"
   custom-template-urls="{calendarWeekView: '/path-to/custom-calendarWeekView.html'}">
</mwl-calendar>

Current config setting, which does work

(function () {
    'use strict';

    angular
        .module('myApp')
        .config(CalendarConfig);

    function CalendarConfig(calendarConfig) {
       calendarConfig.templates.calendarWeekView = '/path-to/custom-calendarWeekView.html';
    }
})();

In case it matters, I am referencing this file for integration:
"angular-bootstrap-calendar/dist/js/angular-bootstrap-calendar-tpls.js"

@mattlewis92

This comment has been minimized.

Copy link
Owner

mattlewis92 commented Aug 10, 2016

Are you on the latest version? A plunker which reproduces your issue would be really helpful!

@mminor-dev

This comment has been minimized.

Copy link
Author

mminor-dev commented Aug 10, 2016

Looks like I'm using version v0.22.0
I will try and get a plunker set up as soon as I can, I am not too familiar with using it..

@mattlewis92

This comment has been minimized.

Copy link
Owner

mattlewis92 commented Aug 10, 2016

You can use this as a starter template: http://plnkr.co/edit/LE4F4U7AnnD3tjM9ZH4G?p=preview

@mminor-dev

This comment has been minimized.

Copy link
Author

mminor-dev commented Aug 10, 2016

Oh! you rock, haha, will use, thank you.

@mattlewis92

This comment has been minimized.

Copy link
Owner

mattlewis92 commented Aug 10, 2016

Also for it to work you need to make sure the template is already in the template cache e.g.

$templateCache.put('/path-to/custom-calendarWeekView.html', 'custom template contents');

or just

<script type="text/ng-template" id="/path-to/custom-calendarWeekView.html">
  custom template contents
</script>
@mminor-dev

This comment has been minimized.

Copy link
Author

mminor-dev commented Aug 10, 2016

Yeah, it's something going with the loading order of my template cache.. I got it to work in a mock project I have - gulp wasn't injecting the templates.js file, adding it manually fixed my issue. However, it i'm still having issues in my actual project, but, that's on me I guess.

Thank you for your help.

@mattlewis92

This comment has been minimized.

Copy link
Owner

mattlewis92 commented Aug 10, 2016

You could always inline the template into the same template that uses the <mwl-calendar> directive using a script tag, that way you'd be guaranteed the template would exist 😄

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.