मेरे पास एक routeProviderटेम्पलेट में एक कस्टम टैग है जो टेम्पलेट के लिए कॉल करता directiveहै। versionविशेषता गुंजाइश जो तब सही टेम्पलेट के लिए कहता है द्वारा भरे जाएंगे।
<hymn ver="before-{{ week }}-{{ day }}"></hymn>
भजन के कई संस्करण हैं जो सप्ताह और दिन के आधार पर हैं। मैं सही .htmlहिस्से को आबाद करने के लिए निर्देश का उपयोग करने का अनुमान लगा रहा था । चर को पढ़ा नहीं जा रहा है templateUrl।
emanuel.directive('hymn', function() {
var contentUrl;
return {
restrict: 'E',
link: function(scope, element, attrs) {
// concatenating the directory to the ver attr to select the correct excerpt for the day
contentUrl = 'content/excerpts/hymn-' + attrs.ver + '.html';
},
// passing in contentUrl variable
templateUrl: contentUrl
}
});
अंश निर्देशिका में एकाधिक फ़ाइलों कि नाम से पुकारा जाता हैं before-1-monday.html, before-2-tuesday.html...