2016-06-14 9 views
1

正しく構築されていない角型プロジェクトを作成しました。私は生産ビルド(distのフォルダ)を実行実行した後、私はこのエラーを取得する:テンプレートの読み込みに失敗しました

Failed to load template: /bundles/craigslist/main.html

これは、ファイルをコピーしているようだが、htmlファイルは、DIST/scripts.jsに住んでいる文字列になってますので、必要に応じて

.config(["$routeProvider", function(a) { 
     a.when("/", { 
      templateUrl:"/bundles/craigslist/main.html", 
      controller:"CraigslistMainCtrl", 
      controllerAs:"craigslist_main_root" 
     }) 

情報::

01、それは私の "/dist/scripts.js" で/bundles/craigslist/main.html

を見つけようと、エラーがスローされます

パターン/ scriptsと/ viewsの代わりに、私は、拡張子にかかわらず、同様のファイルを一緒に整理するバンドルを使用します。たとえば、/ bundles/craigslistフォルダがあり、craigslistテンプレート、サービス、ルートがあります。私はGruntfile.jsを調整してこれを説明しようとしています。

これは私のうなり声ファイルです:https://gist.github.com/ivansifrim/f632832a4ba8f44bf828b5d88066a0ce

これは私のフォルダ構造です:

This is my folder structure

私は運がなくて、ここでAngular/grunt failed to load template議論されたものを適用することを試みました。

答えて

0

試してみてください。

usemin: { 
    html: ['<%= yeoman.dist %>/**/*.html'], 
    css: ['<%= yeoman.dist %>/styles/{,*/}*.css'], 
    js: ['<%= yeoman.dist %>/scripts/{,*/}*.js', '<%= yeoman.dist %>/bundles/{,*/}*.js'], 
    options: { 
    assetsDirs: [ 
     '<%= yeoman.dist %>', 
     '<%= yeoman.dist %>/images', 
     '<%= yeoman.dist %>/styles' 
    ], 
    patterns: { 
     js: [[/(images\/[^''""]*\.(png|jpg|jpeg|gif|webp|svg))/g, 'Replacing references to images']] 
    } 
    } 
} 
+0

が私のために動作していないようでした – user1683056

関連する問題