2017-11-15 5 views
0

私は自分のアングルアプリをビルドしてからこのエラーを表示しました[$ compile:tpload]テンプレートを読み込めませんでした:app/app.html(HTTPステータス:404 Not Found)みんなが私を助けてください!!!!!Angularjsがビルド後にテンプレートを読み込めませんでした

app.html

<div class="root"> 
    <div ui-view></div> 
</div> 

app.component.js

(function(angular) { 
    'use strict' 
    var app = { 
     templateUrl:"app/app.html" 
    } 
    angular.module('mainApp') 
      .component('app',app); 
})(window.angular); 

index.htmlを

<!doctype html> 
<html class="no-js" lang="" ng-app="mainApp"> 
<head> 
    <meta charset="utf-8"> 
    <meta http-equiv="x-ua-compatible" content="ie=edge"> 
    <meta name="description" content=""> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <link rel="apple-touch-icon" href="apple-touch-icon.png"> 
    <title>IES</title> 
     <!-- Place favicon.ico in the root directory --> 
    <!-- Place favicon.ico and apple-touch-icon.png in the root directory --> 

    <!-- build:css({.tmp/serve,src}) styles/vendor.css --> 
    <!-- bower:css --> 
    <!-- run `gulp inject` to automatically populate bower styles dependencies --> 
    <!-- endbower --> 
    <!-- endbuild --> 

    <!-- build:css({.tmp/serve,src}) styles/app.css --> 
    <!-- inject:css --> 
    <!-- css files will be automatically insert here --> 
    <!-- endinject --> 
    <!-- endbuild --> 
    <!--<script src="bower_components/angular/angular.js"></script>--> 
</head> 
<body> 
    <app></app> 
</body> 
<!-- build:js(src) scripts/vendor.js --> 
<!-- bower:js --> 
<!-- run `gulp inject` to automatically populate bower script dependencies --> 
<!-- endbower --> 
<!-- endbuild --> 

<!-- build:js({.tmp/serve,.tmp/partials,src}) scripts/app.js --> 
<!-- inject:js --> 
<!-- js files will be automatically insert here --> 
<!-- endinject --> 

<!-- inject:partials --> 
<!-- angular templates will be automatically converted in js and inserted here --> 
<!-- endinject --> 
<!-- endbuild --> 
</html> 

app.module.js

(function(angular) { 
     'use strict'; 

     angular.module('mainApp',[ 
     'components', 
     'common', 
       ]) 
     .config(['$httpProvider', function ($httpProvider) { 
      $httpProvider.interceptors.push('HeaderInterceptor'); 
      console.log("Configuration Hook"); 
     }]) 

     .run(['$http', '$rootScope', function ($http, $rootScope) { 
     if (typeof $rootScope.global === "undefined") { 
      if (localStorage.getItem('user')) { 
       $rootScope.global = { 
       user: JSON.parse(localStorage.getItem('user')), 
       } 
      } 
     } 
     }]) 

    })(window.angular, window.localStorage); 
あなたはコード全体を見たい場合は210

がここにそれが https://github.com/masresha/testfiles/tree/master/IES/src

+0

あなたはすべてのエラーをパターにコピーできますか? – Salman

+0

エラー:[$ compile:tpload]テンプレートを読み込めませんでした:app/app.html(HTTPステータス:404が見つかりません) http://errors.angularjs.org/1.6.6/$compile/tpload?p0=app vendor.jsにおける%2Fapp.html&P1 = 404&P2 =ません%20Found : lの(vendor.js:44936)vendor.jsで :44980 時間で$消化:U(48139 vendor.js)で28001 (vendor.js:46118) (h)$ apply(vendor.js:46416) l(vendor.js:40432) at v(vendor.js:40670) at XMLHttpRequest.C.onload js:40587) – Masre

+0

GET http://localhost/work/app/app.html 404(見つからない) – Masre

答えて

1

app.component.js

(function(angular) { 
'use strict' 
var app = { 
    templateUrl:"./app.html" 
} 
angular.module('mainApp') 
     .component('app',app); 
})(window.angular); 

であるあなたは、あなたがそれに既にしている、appフォルダを指示する必要はありません。

+0

これは動作していませんが、このエラーを表示していますエラー:[$ compile: tpload]テンプレートの読み込みに失敗しました:./app.html(HTTPステータス:404 Not Found) – Masre

関連する問題