私は自分の角型アプリケーションのディレクティブを作成しました。ディレクティブでtemplateUrlを使用してテンプレートを取得しています。角度指示文のテンプレートのパス?
templateUrl: 'templates/searchbox-template.html',
これは私のローカルサーバー上でうまく働いたが、私はfirebaseにホストしたときに、それはこの警告は、ページを繰り返しページへのindex.htmlを追加し、ループ内で立ち往生また
WARNING: Tried to load angular more than once
をrepeatedly-います。 ディレクティブを使用したナビゲーションバーの会社または仕事のタブに行くと、hereというアプリが表示されます。 これを止めるためにどのパスを使用すればよいかわかりません。ここにアプリケーションの構造はありますか?
.
├── app
│ ├── 404.html
│ ├── favicon.ico
│ ├── images
│ ├── index.html
│ ├── robots.txt
│ ├── scripts
│ ├── styles
│ ├── templates
│ └── views
├── bower_components
│ ├── angular
│ ├── angular-mocks
│ ├── angular-route
│ ├── animate.css
│ ├── bootstrap
│ ├── jquery
│ └── jssocials
├── bower.json
├── dist
│ ├── 404.html
│ ├── favicon.ico
│ ├── fonts
│ ├── index.html
│ ├── robots.txt
│ ├── scripts
│ └── styles
├── firebase.json
.
├── app
│ ├── 404.html
│ ├── favicon.ico
│ ├── images
│ ├── index.html
│ ├── robots.txt
│ ├── scripts
│ │ ├── app.js
│ │ ├── controllers
│ │ ├── directives
│ │ └── services
│ ├── styles
│ │ └── main.css
│ ├── templates
│ │ └── searchbox-template.html
│ └── views
│ ├── about.html
│ ├── companiesall.html
│ ├── company.html
│ ├── contact.html
│ ├── jobsall.html
│ └── main.html
ご覧のとおり、私のテンプレートはテンプレートフォルダにあります。これで私を助けてください。ありがとうございました。
アップデート - 私はちょうど右のパスを把握する必要があり
.otherwise({
redirectTo: '/'
});
を - このanswerにAccoringは、ディレクティブは、したがって、このために何度も何度ものindex.htmlをロードしたテンプレートを見つけることができませんテンプレートの
{
"hosting": {
"public": "dist",
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
テンプレートが偶然NG-アプリディレクティブが含まれていることをしていますか?このメッセージは、すでにメインテンプレートにng-appがあり、そこにng-appを持つ別のテンプレートを読み込もうとした場合に発生します。 – stevenelberger
いいえ、ng-appはindex.htmlファイル内にのみあります。 – doctorsherlock
サーバの設定に依存しますが、 ''/''がルートディレクトリの' 'index.html''を参照している場合は、' '/ templates/searchbox-template.html' 'という正しいパスがあると思います。 – stevenelberger