मैं एक templateCache.js फ़ाइल जिसमें 1. (my full gulpfile)टेम्पलेट कैश में टेम्पलेट पथ कैसे ठीक करें? (घूंट-कोणीय templatecache)
मेरी सभी HTML टेम्पलेट फ़ाइलों को जोड़ती इंजेक्शन लगाने के बाद उत्पन्न करने के लिए gulp-angular-templatecache उपयोग कर रहा हूँ कि मेरे ऐप में नया मॉड्यूल, मेरे निर्देशों होगा स्वचालित रूप से टेम्पलेट्स उठाएं और मुझे अपने निर्माण फ़ोल्डर में आंशिक .html फ़ाइलों को जोड़ने की आवश्यकता नहीं होगी।
समस्या यह है कि है अग्रणी फ़ोल्डर पथ काट रहा है, नीचे मेरी उदाहरण देखें:
मेरे निर्देशों में पथ:
templateUrl : "panels/tags/tagsPanel.html"...
templateUrl : "header/platform_header/platformHeader.html"...
मेरी उत्पादित templateCache फाइल में पथ:
$templateCache.put("tags/tagsPanel.html"...
$templateCache.put("platform_header/platformHeader.html"...
^panels
और header
खो रहे हैं।
मैं एक समारोह है कि ठीक कर देंगे कि मेरे Gulpfile में लिखने की कोशिश कर रहा हूँ।
मेरी Gulpfile की config अनुभाग:
var config = {
srcPartials:[
'app/beta/*.html',
'app/header/**/*.html',
'app/help/*.html',
'app/login/*.html',
'app/notificaitons/*.html',
'app/panels/**/*.html',
'app/popovers/**/*.html',
'app/popovers/*.html',
'app/user/*.html',
'app/dashboard.html'
],
srcPaths:[
'beta/',
'header/',
'help/',
'login/',
'notificaitons/',
'panels/',
'popovers/',
'popovers/',
'user/',
'dashboard.html'
],
destPartials: 'app/templates/'
};
मेरे html-templates
gulp.task
gulp.task('html-templates', function() {
return gulp.src(config.srcPartials)
.pipe(templateCache('templateCache.js', {
root: updateRoot(config.srcPaths)
},
{ module:'templateCache', standalone:true })
).pipe(gulp.dest(config.destPartials));
});
function updateRoot(paths) {
for (var i = 0; i < paths.length; i++) {
// console.log(paths);
console.log(paths[i]);
return paths[i];
}
}
^ऊपर काम कर रहा है, जबकि इसमें gulp-angular-templatecache में root option का उपयोग करता है एक नया स्ट्रिंग संलग्न करने के लिए टेम्पलेट पथ के सामने।
समस्या मेरा कोड एक बार रिटर्न से ऊपर है और रास्ते में पहले आइटम के सभी पथ अपडेट करता है जो beta/
है।
आप इसे कैसे लिखेंगे ताकि यह प्रत्येक फ़ाइल के लिए पथ को सही ढंग से बदल सके?
मुझे एक ही समस्या मिली और एक ही समाधान मिला लेकिन यह काम नहीं कर रहा है। मेरा कोड: http://pastebin.com/8Ub88fWA आपकी मदद के लिए धन्यवाद – AlainIb
क्या आपको टेम्पलेट कैश मॉड्यूल को इंजेक्ट या लोड करने की आवश्यकता है? – AlainIb
हाँ इसे अपने मुख्य ऐप मॉड्यूल में इंजेक्ट करें –