Angular 2 relative templateUrl not working

ZanattMan

Creating my first Angular 2 app I'm trying to set my template in an html file using templateUrl.

At the moment, I have the component.ts and the view.html in the same folder under src/ folder and I'm using this:

@Component({
  selector: 'relative-path',
  templateUrl: 'view.html'
})

Once running the app the console say:

zone.js:1274GET http://localhost:3000/personalData.html 404 (Not Found)

Any idea what I'm doing wrong?

ZanattMan

Solved!

@Component({
  selector: 'relative-path',
  template: require('view.html')
})

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

external template (templateURL) in Angular directive is not working

分類Dev

Angular 2安定版:templateUrl変数

分類Dev

add more than one templateUrl in One component in angular2

分類Dev

Angular giving a weird templateURL

分類Dev

Cakephp 2.x relative path is not working but absulate path is working

分類Dev

*ngFor is not working in angular 2

分類Dev

Angular2 + WebpackでtemplateUrlの相対パスを使用する

分類Dev

Angular2 + WebpackでtemplateUrlの相対パスを使用する

分類Dev

"Can't read the url" error for angular2 dynamic components with templateUrl

分類Dev

Angular2相対templateUrlが機能しない

分類Dev

Angular2のtemplateUrlのベースパス

分類Dev

Angular2の「テンプレート」と「templateUrl」の問題

分類Dev

templateUrl使用時のAngular2テストエラー

分類Dev

Angular 2 ngSwitchCase, OR operator not working

分類Dev

DefaultExtension not working in Angular 2 app

分類Dev

Angular 2 incremental counter not working

分類Dev

Relative pack URI not working

分類Dev

奇妙なtemplateURLを与えるAngular

分類Dev

Angular UI-Router templateUrl Issue

分類Dev

express+angular、templateURLの使い方

分類Dev

変数を使用してAngular2でtemplateUrlを定義する方法

分類Dev

Angular2ディレクティブでtemplateUrlを使用する方法

分類Dev

templateUrlの使用中にAngular2エラーが発生しました

分類Dev

Angular2コンポーネントtemplateUrlが表示されない

分類Dev

Relative URLs when working on localhost

分類Dev

Angular2 set variable on subscribe not working

分類Dev

Angular 2 - Basic form validation not working anymore

分類Dev

Declaration Merging not Working in Angular 2 Project

分類Dev

Angular ng2-opd-popup not working

Related 関連記事

  1. 1

    external template (templateURL) in Angular directive is not working

  2. 2

    Angular 2安定版:templateUrl変数

  3. 3

    add more than one templateUrl in One component in angular2

  4. 4

    Angular giving a weird templateURL

  5. 5

    Cakephp 2.x relative path is not working but absulate path is working

  6. 6

    *ngFor is not working in angular 2

  7. 7

    Angular2 + WebpackでtemplateUrlの相対パスを使用する

  8. 8

    Angular2 + WebpackでtemplateUrlの相対パスを使用する

  9. 9

    "Can't read the url" error for angular2 dynamic components with templateUrl

  10. 10

    Angular2相対templateUrlが機能しない

  11. 11

    Angular2のtemplateUrlのベースパス

  12. 12

    Angular2の「テンプレート」と「templateUrl」の問題

  13. 13

    templateUrl使用時のAngular2テストエラー

  14. 14

    Angular 2 ngSwitchCase, OR operator not working

  15. 15

    DefaultExtension not working in Angular 2 app

  16. 16

    Angular 2 incremental counter not working

  17. 17

    Relative pack URI not working

  18. 18

    奇妙なtemplateURLを与えるAngular

  19. 19

    Angular UI-Router templateUrl Issue

  20. 20

    express+angular、templateURLの使い方

  21. 21

    変数を使用してAngular2でtemplateUrlを定義する方法

  22. 22

    Angular2ディレクティブでtemplateUrlを使用する方法

  23. 23

    templateUrlの使用中にAngular2エラーが発生しました

  24. 24

    Angular2コンポーネントtemplateUrlが表示されない

  25. 25

    Relative URLs when working on localhost

  26. 26

    Angular2 set variable on subscribe not working

  27. 27

    Angular 2 - Basic form validation not working anymore

  28. 28

    Declaration Merging not Working in Angular 2 Project

  29. 29

    Angular ng2-opd-popup not working

ホットタグ

アーカイブ